Skip to content
This repository was archived by the owner on Apr 18, 2024. It is now read-only.

Commit 2e7a708

Browse files
committed
Split write to another package
1 parent b675f38 commit 2e7a708

File tree

5 files changed

+82
-1
lines changed

5 files changed

+82
-1
lines changed

packages/core/cli.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ async function main() {
4040
return;
4141
}
4242
case "write": {
43-
const command = require("./src/write");
43+
const command = require("@contentz/write");
4444
await command(files);
4545
return;
4646
}

packages/core/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@
3939
"@babel/core": "^7.3.4",
4040
"@babel/preset-env": "^7.3.4",
4141
"@contentz/init": "^3.11.0",
42+
"@contentz/write": "^3.11.0",
4243
"@emotion/babel-preset-css-prop": "^10.0.9",
4344
"@emotion/core": "^10.0.7",
4445
"@mdx-js/mdx": "^0.17.5",

packages/write/cli.js

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
#!/usr/bin/env node
2+
const meow = require("meow");
3+
const chalk = require("chalk");
4+
5+
const pkg = require("./package.json.js");
6+
const command = require("./src/index.js.js");
7+
8+
async function main() {
9+
const cli = meow(
10+
`${chalk.white("Usage")}
11+
$ ${chalk.cyan("contentz-write")} Write a new article using Contentz
12+
$ ${chalk.cyan("contentz-write help")} Show this message
13+
`,
14+
{
15+
description: `${chalk.cyan("Contentz Write")} - ${pkg.description}`
16+
}
17+
);
18+
19+
let args = cli.input;
20+
cmd = args[0].toLowerCase();
21+
22+
switch (cmd) {
23+
case "help": {
24+
return cli.showHelp(0);
25+
}
26+
default: {
27+
await command(args);
28+
return;
29+
}
30+
}
31+
}
32+
33+
main().catch(error => {
34+
console.error(error);
35+
process.exit(1);
36+
});

packages/write/package.json

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
{
2+
"name": "@contentz/write",
3+
"description": "Write a new Contentz article",
4+
"version": "3.11.0",
5+
"main": "src/index.js",
6+
"bin": {
7+
"contentz-init": "./cli.js"
8+
},
9+
"files": [
10+
"src",
11+
"cli.js",
12+
"package.json"
13+
],
14+
"keywords": [
15+
"contentz",
16+
"ssg",
17+
"static",
18+
"website",
19+
"optimized",
20+
"performance",
21+
"offline first",
22+
"mdx",
23+
"i18n"
24+
],
25+
"repository": "https://github.com/sergiodxa/contentz.git",
26+
"author": {
27+
"name": "Sergio Xalambrí",
28+
"email": "hello@sergiodxa.com",
29+
"url": "https://sergiodxa.com"
30+
},
31+
"homepage": "https://contentz.tech",
32+
"bugs": {
33+
"email": "hello+contentz@sergiodxa.com",
34+
"url": "https://github.com/sergiodxa/contentz/issues"
35+
},
36+
"license": "MIT",
37+
"dependencies": {
38+
"@contentz/utils": "^3.11.0",
39+
"chalk": "^2.4.2",
40+
"cli-prompt": "^0.6.0",
41+
"meow": "^5.0.0",
42+
"open-editor": "^1.2.0"
43+
}
44+
}

0 commit comments

Comments
 (0)