create-appsemble 0.20.11 → 0.20.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +4 -4
- package/commands/block.js +26 -30
- package/commands/block.js.map +1 -1
- package/commands/block.ts +12 -8
- package/index.js +8 -34
- package/index.js.map +1 -1
- package/index.ts +6 -4
- package/jest.config.js +3 -1
- package/package.json +8 -9
- package/templates/mini-jsx/package.json +2 -1
- package/templates/preact/package.json +3 -2
- package/templates/vanilla/package.json +2 -1
- package/tsconfig.json +0 -1
package/README.md
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
#  Appsemble Create
|
|
2
2
|
|
|
3
3
|
> Bootstrap an Appsemble block
|
|
4
4
|
|
|
5
5
|
[](https://www.npmjs.com/package/create-appsemble)
|
|
6
|
-
[](https://gitlab.com/appsemble/appsemble/-/releases/0.20.14)
|
|
7
|
+
[](https://codecov.io/gl/appsemble/appsemble)
|
|
8
8
|
[](https://prettier.io)
|
|
9
9
|
|
|
10
10
|
## Usage
|
|
@@ -31,5 +31,5 @@ npm init appsemble block
|
|
|
31
31
|
|
|
32
32
|
## License
|
|
33
33
|
|
|
34
|
-
[LGPL-3.0-only](https://gitlab.com/appsemble/appsemble/-/blob/0.
|
|
34
|
+
[LGPL-3.0-only](https://gitlab.com/appsemble/appsemble/-/blob/0.20.14/LICENSE.md) ©
|
|
35
35
|
[Appsemble](https://appsemble.com)
|
package/commands/block.js
CHANGED
|
@@ -1,20 +1,13 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
const
|
|
8
|
-
const
|
|
9
|
-
|
|
10
|
-
const
|
|
11
|
-
const inquirer_1 = __importDefault(require("inquirer"));
|
|
12
|
-
const package_json_1 = __importDefault(require("../package.json"));
|
|
13
|
-
const templateDir = (0, path_1.resolve)(__dirname, '../templates');
|
|
14
|
-
exports.command = 'block';
|
|
15
|
-
exports.description = 'Bootstrap a new Appsemble block.';
|
|
16
|
-
async function builder(yargs) {
|
|
17
|
-
const choices = await (0, promises_1.readdir)(templateDir);
|
|
1
|
+
import { cp, readdir } from 'fs/promises';
|
|
2
|
+
import { join } from 'path';
|
|
3
|
+
import { logger, readData, writeData } from '@appsemble/node-utils';
|
|
4
|
+
import inquirer from 'inquirer';
|
|
5
|
+
import pkg from '../package.json' assert { type: 'json' };
|
|
6
|
+
const templateDir = new URL('../templates/', import.meta.url);
|
|
7
|
+
export const command = 'block';
|
|
8
|
+
export const description = 'Bootstrap a new Appsemble block.';
|
|
9
|
+
export async function builder(yargs) {
|
|
10
|
+
const choices = await readdir(templateDir);
|
|
18
11
|
return yargs
|
|
19
12
|
.option('organization', {
|
|
20
13
|
describe: 'The ID the block should be created for.',
|
|
@@ -27,10 +20,9 @@ async function builder(yargs) {
|
|
|
27
20
|
choices,
|
|
28
21
|
});
|
|
29
22
|
}
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
const
|
|
33
|
-
const answers = await inquirer_1.default.prompt([
|
|
23
|
+
export async function handler(args) {
|
|
24
|
+
const choices = await readdir(templateDir);
|
|
25
|
+
const answers = await inquirer.prompt([
|
|
34
26
|
!args.organization && {
|
|
35
27
|
name: 'organization',
|
|
36
28
|
message: 'For which organization is the block?',
|
|
@@ -46,19 +38,23 @@ async function handler(args) {
|
|
|
46
38
|
const organization = answers.organization || args.organization;
|
|
47
39
|
const name = answers.name || args.name;
|
|
48
40
|
const template = answers.template || args.template;
|
|
49
|
-
const { version } =
|
|
50
|
-
const outputPath =
|
|
51
|
-
const inputPath = (
|
|
52
|
-
const pkgPath =
|
|
53
|
-
const [inputPkg] = await
|
|
41
|
+
const { version } = pkg;
|
|
42
|
+
const outputPath = join(process.cwd(), 'blocks', name);
|
|
43
|
+
const inputPath = new URL(`${template}/`, templateDir);
|
|
44
|
+
const pkgPath = new URL('package.json', inputPath);
|
|
45
|
+
const [inputPkg] = await readData(pkgPath);
|
|
54
46
|
const outputPkg = {
|
|
55
47
|
name: `@${organization}/${name}`,
|
|
56
48
|
version,
|
|
57
49
|
...inputPkg,
|
|
58
50
|
};
|
|
59
|
-
await (
|
|
60
|
-
|
|
61
|
-
|
|
51
|
+
await cp(inputPath, outputPath, {
|
|
52
|
+
errorOnExist: true,
|
|
53
|
+
filter: (src) => !src.endsWith('package.json'),
|
|
54
|
+
force: false,
|
|
55
|
+
recursive: true,
|
|
56
|
+
});
|
|
57
|
+
await writeData(join(outputPath, 'package.json'), outputPkg);
|
|
58
|
+
logger.info(`Successfully created @${organization}/${name}/${version} at ${outputPath}`);
|
|
62
59
|
}
|
|
63
|
-
exports.handler = handler;
|
|
64
60
|
//# sourceMappingURL=block.js.map
|
package/commands/block.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"block.js","sourceRoot":"","sources":["block.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"block.js","sourceRoot":"","sources":["block.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAC1C,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAE5B,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AACpE,OAAO,QAAQ,MAAM,UAAU,CAAC;AAIhC,OAAO,GAAG,MAAM,iBAAiB,CAAC,SAAS,IAAI,EAAE,MAAM,EAAE,CAAC;AAE1D,MAAM,WAAW,GAAG,IAAI,GAAG,CAAC,eAAe,EAAE,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAE9D,MAAM,CAAC,MAAM,OAAO,GAAG,OAAO,CAAC;AAC/B,MAAM,CAAC,MAAM,WAAW,GAAG,kCAAkC,CAAC;AAQ9D,MAAM,CAAC,KAAK,UAAU,OAAO,CAAC,KAAW;IACvC,MAAM,OAAO,GAAG,MAAM,OAAO,CAAC,WAAW,CAAC,CAAC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ACvD,MAAM,OAAO,GAAG,IAAI,GAAG,CAAC,cAAc,EAAE,SAAS,CAAC,CAAC;IACnD,MAAM,CAAC,QAAQ,CAAC,GAAG,MAAM,QAAQ,CAAc,OAAO,CAAC,CAAC;IACxD,MAAM,SAAS,GAAG;QAChB,IAAI,EAAE,IAAI,YAAY,IAAI,IAAI,EAAE;QAChC,OAAO;QACP,GAAG,QAAQ;KACZ,CAAC;IACF,MAAM,EAAE,CAAC,SAAS,EAAE,UAAU,EAAE;QAC9B,YAAY,EAAE,IAAI;QAClB,MAAM,EAAE,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC,GAAG,CAAC,QAAQ,CAAC,cAAc,CAAC;QAC9C,KAAK,EAAE,KAAK;QACZ,SAAS,EAAE,IAAI;KAChB,CAAC,CAAC;IACH,MAAM,SAAS,CAAC,IAAI,CAAC,UAAU,EAAE,cAAc,CAAC,EAAE,SAAS,CAAC,CAAC;IAC7D,MAAM,CAAC,IAAI,CAAC,yBAAyB,YAAY,IAAI,IAAI,IAAI,OAAO,OAAO,UAAU,EAAE,CAAC,CAAC;AAC3F,CAAC"}
|
package/commands/block.ts
CHANGED
|
@@ -1,15 +1,14 @@
|
|
|
1
|
-
import { readdir } from 'fs/promises';
|
|
2
|
-
import { join
|
|
1
|
+
import { cp, readdir } from 'fs/promises';
|
|
2
|
+
import { join } from 'path';
|
|
3
3
|
|
|
4
4
|
import { logger, readData, writeData } from '@appsemble/node-utils';
|
|
5
|
-
import { copy } from 'fs-extra';
|
|
6
5
|
import inquirer from 'inquirer';
|
|
7
6
|
import { PackageJson } from 'type-fest';
|
|
8
7
|
import { Argv } from 'yargs';
|
|
9
8
|
|
|
10
|
-
import pkg from '../package.json';
|
|
9
|
+
import pkg from '../package.json' assert { type: 'json' };
|
|
11
10
|
|
|
12
|
-
const templateDir =
|
|
11
|
+
const templateDir = new URL('../templates/', import.meta.url);
|
|
13
12
|
|
|
14
13
|
export const command = 'block';
|
|
15
14
|
export const description = 'Bootstrap a new Appsemble block.';
|
|
@@ -60,15 +59,20 @@ export async function handler(args: BlockArgs): Promise<void> {
|
|
|
60
59
|
|
|
61
60
|
const { version } = pkg;
|
|
62
61
|
const outputPath = join(process.cwd(), 'blocks', name);
|
|
63
|
-
const inputPath =
|
|
64
|
-
const pkgPath =
|
|
62
|
+
const inputPath = new URL(`${template}/`, templateDir);
|
|
63
|
+
const pkgPath = new URL('package.json', inputPath);
|
|
65
64
|
const [inputPkg] = await readData<PackageJson>(pkgPath);
|
|
66
65
|
const outputPkg = {
|
|
67
66
|
name: `@${organization}/${name}`,
|
|
68
67
|
version,
|
|
69
68
|
...inputPkg,
|
|
70
69
|
};
|
|
71
|
-
await
|
|
70
|
+
await cp(inputPath, outputPath, {
|
|
71
|
+
errorOnExist: true,
|
|
72
|
+
filter: (src) => !src.endsWith('package.json'),
|
|
73
|
+
force: false,
|
|
74
|
+
recursive: true,
|
|
75
|
+
});
|
|
72
76
|
await writeData(join(outputPath, 'package.json'), outputPkg);
|
|
73
77
|
logger.info(`Successfully created @${organization}/${name}/${version} at ${outputPath}`);
|
|
74
78
|
}
|
package/index.js
CHANGED
|
@@ -1,36 +1,10 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
}
|
|
9
|
-
Object.defineProperty(o, k2, desc);
|
|
10
|
-
}) : (function(o, m, k, k2) {
|
|
11
|
-
if (k2 === undefined) k2 = k;
|
|
12
|
-
o[k2] = m[k];
|
|
13
|
-
}));
|
|
14
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
15
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
16
|
-
}) : function(o, v) {
|
|
17
|
-
o["default"] = v;
|
|
18
|
-
});
|
|
19
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
20
|
-
if (mod && mod.__esModule) return mod;
|
|
21
|
-
var result = {};
|
|
22
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
23
|
-
__setModuleDefault(result, mod);
|
|
24
|
-
return result;
|
|
25
|
-
};
|
|
26
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
27
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
28
|
-
};
|
|
29
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
30
|
-
const node_utils_1 = require("@appsemble/node-utils");
|
|
31
|
-
const yargs_1 = __importDefault(require("yargs"));
|
|
32
|
-
const block = __importStar(require("./commands/block"));
|
|
33
|
-
yargs_1.default
|
|
2
|
+
import { configureLogger, handleError } from '@appsemble/node-utils';
|
|
3
|
+
import yargs from 'yargs';
|
|
4
|
+
import * as block from './commands/block.js';
|
|
5
|
+
import pkg from './package.json' assert { type: 'json' };
|
|
6
|
+
yargs()
|
|
7
|
+
.version(pkg.version)
|
|
34
8
|
.option('verbose', {
|
|
35
9
|
alias: 'v',
|
|
36
10
|
describe: 'Increase verbosity',
|
|
@@ -41,10 +15,10 @@ yargs_1.default
|
|
|
41
15
|
describe: 'Decrease verbosity',
|
|
42
16
|
type: 'count',
|
|
43
17
|
})
|
|
44
|
-
.middleware([
|
|
18
|
+
.middleware([configureLogger])
|
|
45
19
|
.command(block)
|
|
46
20
|
.demandCommand(1)
|
|
47
|
-
.fail(
|
|
21
|
+
.fail(handleError)
|
|
48
22
|
.help()
|
|
49
23
|
.completion()
|
|
50
24
|
.parse(process.argv.slice(2));
|
package/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,eAAe,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AACrE,OAAO,KAAwB,MAAM,OAAO,CAAC;AAE7C,OAAO,KAAK,KAAK,MAAM,qBAAqB,CAAC;AAC7C,OAAO,GAAG,MAAM,gBAAgB,CAAC,SAAS,IAAI,EAAE,MAAM,EAAE,CAAC;AAEzD,KAAK,EAAE;KACJ,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC;KACpB,MAAM,CAAC,SAAS,EAAE;IACjB,KAAK,EAAE,GAAG;IACV,QAAQ,EAAE,oBAAoB;IAC9B,IAAI,EAAE,OAAO;CACd,CAAC;KACD,MAAM,CAAC,OAAO,EAAE;IACf,KAAK,EAAE,GAAG;IACV,QAAQ,EAAE,oBAAoB;IAC9B,IAAI,EAAE,OAAO;CACd,CAAC;KACD,UAAU,CAAC,CAAC,eAAe,CAAC,CAAC;KAC7B,OAAO,CAAC,KAAiC,CAAC;KAC1C,aAAa,CAAC,CAAC,CAAC;KAChB,IAAI,CAAC,WAAW,CAAC;KACjB,IAAI,EAAE;KACN,UAAU,EAAE;KACZ,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC"}
|
package/index.ts
CHANGED
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { configureLogger, handleError } from '@appsemble/node-utils';
|
|
3
|
-
import yargs from 'yargs';
|
|
3
|
+
import yargs, { CommandModule } from 'yargs';
|
|
4
4
|
|
|
5
|
-
import * as block from './commands/block';
|
|
5
|
+
import * as block from './commands/block.js';
|
|
6
|
+
import pkg from './package.json' assert { type: 'json' };
|
|
6
7
|
|
|
7
|
-
yargs
|
|
8
|
+
yargs()
|
|
9
|
+
.version(pkg.version)
|
|
8
10
|
.option('verbose', {
|
|
9
11
|
alias: 'v',
|
|
10
12
|
describe: 'Increase verbosity',
|
|
@@ -16,7 +18,7 @@ yargs
|
|
|
16
18
|
type: 'count',
|
|
17
19
|
})
|
|
18
20
|
.middleware([configureLogger])
|
|
19
|
-
.command(block)
|
|
21
|
+
.command(block as unknown as CommandModule)
|
|
20
22
|
.demandCommand(1)
|
|
21
23
|
.fail(handleError)
|
|
22
24
|
.help()
|
package/jest.config.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-appsemble",
|
|
3
|
-
"version": "0.20.
|
|
3
|
+
"version": "0.20.14",
|
|
4
4
|
"description": "Bootstrap an Appsemble project",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"app",
|
|
@@ -20,7 +20,8 @@
|
|
|
20
20
|
},
|
|
21
21
|
"license": "LGPL-3.0-only",
|
|
22
22
|
"author": "Appsemble <info@appsemble.com> (https://appsemble.com)",
|
|
23
|
-
"
|
|
23
|
+
"type": "module",
|
|
24
|
+
"bin": "./index.js",
|
|
24
25
|
"files": [
|
|
25
26
|
"**/*.d.ts",
|
|
26
27
|
"**/*.js",
|
|
@@ -29,20 +30,18 @@
|
|
|
29
30
|
],
|
|
30
31
|
"scripts": {
|
|
31
32
|
"prepack": "tsc --noEmit false",
|
|
32
|
-
"test": "jest"
|
|
33
|
+
"test": "NODE_OPTIONS=--experimental-vm-modules jest"
|
|
33
34
|
},
|
|
34
35
|
"dependencies": {
|
|
35
|
-
"@appsemble/node-utils": "0.20.
|
|
36
|
-
"
|
|
37
|
-
"inquirer": "^8.0.0",
|
|
36
|
+
"@appsemble/node-utils": "0.20.14",
|
|
37
|
+
"inquirer": "^9.0.0",
|
|
38
38
|
"type-fest": "^2.0.0",
|
|
39
39
|
"yargs": "^17.0.0"
|
|
40
40
|
},
|
|
41
41
|
"devDependencies": {
|
|
42
|
-
"@types/
|
|
43
|
-
"@types/inquirer": "^8.0.0"
|
|
42
|
+
"@types/inquirer": "^9.0.0"
|
|
44
43
|
},
|
|
45
44
|
"engines": {
|
|
46
|
-
"node": ">=
|
|
45
|
+
"node": ">=18"
|
|
47
46
|
}
|
|
48
47
|
}
|