ic-mops 0.37.9 → 0.38.1
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/commands/template.ts +12 -0
- package/commands/toolchain/index.ts +3 -1
- package/dist/commands/template.js +12 -0
- package/dist/commands/toolchain/index.js +3 -1
- package/dist/package.json +1 -1
- package/dist/templates/mops-publish.yml +17 -0
- package/dist/templates/mops-test.yml +4 -12
- package/package.json +1 -1
- package/templates/mops-publish.yml +17 -0
- package/templates/mops-test.yml +4 -12
package/commands/template.ts
CHANGED
|
@@ -18,6 +18,7 @@ export async function template(templateName?: string, options: any = {}) {
|
|
|
18
18
|
{title: 'License MIT', value: 'license:MIT'},
|
|
19
19
|
{title: 'License Apache-2.0', value: 'license:Apache-2.0'},
|
|
20
20
|
{title: 'GitHub Workflow to run \'mops test\'', value: 'github-workflow:mops-test'},
|
|
21
|
+
{title: 'GitHub Workflow to publish a package', value: 'github-workflow:mops-publish'},
|
|
21
22
|
{title: '× Cancel', value: ''},
|
|
22
23
|
],
|
|
23
24
|
initial: 0,
|
|
@@ -36,6 +37,17 @@ export async function template(templateName?: string, options: any = {}) {
|
|
|
36
37
|
fs.copyFileSync(mopsTestYml, dest);
|
|
37
38
|
console.log(chalk.green('Created'), path.relative(getRootDir(), dest));
|
|
38
39
|
}
|
|
40
|
+
else if (templateName === 'github-workflow:mops-publish') {
|
|
41
|
+
let dest = path.resolve(getRootDir(), '.github/workflows/mops-publish.yml');
|
|
42
|
+
if (fs.existsSync(dest)) {
|
|
43
|
+
console.log(chalk.yellow('Workflow already exists:'), path.relative(getRootDir(), dest));
|
|
44
|
+
return;
|
|
45
|
+
}
|
|
46
|
+
let mopsPublishYml = new URL('../templates/mops-publish.yml', import.meta.url);
|
|
47
|
+
fs.mkdirSync(path.resolve(getRootDir(), '.github/workflows'), {recursive: true});
|
|
48
|
+
fs.copyFileSync(mopsPublishYml, dest);
|
|
49
|
+
console.log(chalk.green('Created'), path.relative(getRootDir(), dest));
|
|
50
|
+
}
|
|
39
51
|
else if (templateName?.startsWith('license:')) {
|
|
40
52
|
let dest = path.resolve(getRootDir(), 'LICENSE');
|
|
41
53
|
if (fs.existsSync(dest)) {
|
|
@@ -68,7 +68,9 @@ async function init({reset = false, silent = false} = {}) {
|
|
|
68
68
|
console.log('2. Run "npm uninstall -g mocv"');
|
|
69
69
|
console.log('TIP: Alternative to "mocv use <version>" is "mops toolchain use moc <version>" (installs moc only for current project)');
|
|
70
70
|
console.log('TIP: More details at https://docs.mops.one/cli/toolchain');
|
|
71
|
-
process.
|
|
71
|
+
if (!process.env.CI || !silent) {
|
|
72
|
+
process.exit(1);
|
|
73
|
+
}
|
|
72
74
|
}
|
|
73
75
|
}
|
|
74
76
|
catch {}
|
|
@@ -17,6 +17,7 @@ export async function template(templateName, options = {}) {
|
|
|
17
17
|
{ title: 'License MIT', value: 'license:MIT' },
|
|
18
18
|
{ title: 'License Apache-2.0', value: 'license:Apache-2.0' },
|
|
19
19
|
{ title: 'GitHub Workflow to run \'mops test\'', value: 'github-workflow:mops-test' },
|
|
20
|
+
{ title: 'GitHub Workflow to publish a package', value: 'github-workflow:mops-publish' },
|
|
20
21
|
{ title: '× Cancel', value: '' },
|
|
21
22
|
],
|
|
22
23
|
initial: 0,
|
|
@@ -34,6 +35,17 @@ export async function template(templateName, options = {}) {
|
|
|
34
35
|
fs.copyFileSync(mopsTestYml, dest);
|
|
35
36
|
console.log(chalk.green('Created'), path.relative(getRootDir(), dest));
|
|
36
37
|
}
|
|
38
|
+
else if (templateName === 'github-workflow:mops-publish') {
|
|
39
|
+
let dest = path.resolve(getRootDir(), '.github/workflows/mops-publish.yml');
|
|
40
|
+
if (fs.existsSync(dest)) {
|
|
41
|
+
console.log(chalk.yellow('Workflow already exists:'), path.relative(getRootDir(), dest));
|
|
42
|
+
return;
|
|
43
|
+
}
|
|
44
|
+
let mopsPublishYml = new URL('../templates/mops-publish.yml', import.meta.url);
|
|
45
|
+
fs.mkdirSync(path.resolve(getRootDir(), '.github/workflows'), { recursive: true });
|
|
46
|
+
fs.copyFileSync(mopsPublishYml, dest);
|
|
47
|
+
console.log(chalk.green('Created'), path.relative(getRootDir(), dest));
|
|
48
|
+
}
|
|
37
49
|
else if (templateName?.startsWith('license:')) {
|
|
38
50
|
let dest = path.resolve(getRootDir(), 'LICENSE');
|
|
39
51
|
if (fs.existsSync(dest)) {
|
|
@@ -61,7 +61,9 @@ async function init({ reset = false, silent = false } = {}) {
|
|
|
61
61
|
console.log('2. Run "npm uninstall -g mocv"');
|
|
62
62
|
console.log('TIP: Alternative to "mocv use <version>" is "mops toolchain use moc <version>" (installs moc only for current project)');
|
|
63
63
|
console.log('TIP: More details at https://docs.mops.one/cli/toolchain');
|
|
64
|
-
process.
|
|
64
|
+
if (!process.env.CI || !silent) {
|
|
65
|
+
process.exit(1);
|
|
66
|
+
}
|
|
65
67
|
}
|
|
66
68
|
}
|
|
67
69
|
catch { }
|
package/dist/package.json
CHANGED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
name: publish on mops
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
release:
|
|
5
|
+
types: [released]
|
|
6
|
+
|
|
7
|
+
jobs:
|
|
8
|
+
publish:
|
|
9
|
+
runs-on: ubuntu-latest
|
|
10
|
+
|
|
11
|
+
steps:
|
|
12
|
+
- uses: actions/checkout@v4
|
|
13
|
+
- uses: ZenVoich/setup-mops@v1
|
|
14
|
+
with:
|
|
15
|
+
# Make sure you set the MOPS_IDENTITY_PEM secret in your repository settings https://docs.github.com/en/actions/security-guides/using-secrets-in-github-actions#creating-secrets-for-a-repository
|
|
16
|
+
identity-pem: ${{ secrets.MOPS_IDENTITY_PEM }}
|
|
17
|
+
- run: mops publish
|
|
@@ -12,19 +12,11 @@ jobs:
|
|
|
12
12
|
runs-on: ubuntu-latest
|
|
13
13
|
|
|
14
14
|
steps:
|
|
15
|
-
- uses: actions/checkout@
|
|
16
|
-
- uses:
|
|
17
|
-
with:
|
|
18
|
-
node-version: 20
|
|
15
|
+
- uses: actions/checkout@v4
|
|
16
|
+
- uses: ZenVoich/setup-mops@v1
|
|
19
17
|
|
|
20
|
-
- name:
|
|
21
|
-
run:
|
|
22
|
-
|
|
23
|
-
- name: install mops packages
|
|
24
|
-
run: mops install
|
|
25
|
-
|
|
26
|
-
- name: install moc
|
|
27
|
-
run: mops toolchain use moc latest
|
|
18
|
+
- name: make sure moc is installed
|
|
19
|
+
run: mops toolchain bin moc || mops toolchain use moc latest
|
|
28
20
|
|
|
29
21
|
- name: run tests
|
|
30
22
|
run: mops test
|
package/package.json
CHANGED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
name: publish on mops
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
release:
|
|
5
|
+
types: [released]
|
|
6
|
+
|
|
7
|
+
jobs:
|
|
8
|
+
publish:
|
|
9
|
+
runs-on: ubuntu-latest
|
|
10
|
+
|
|
11
|
+
steps:
|
|
12
|
+
- uses: actions/checkout@v4
|
|
13
|
+
- uses: ZenVoich/setup-mops@v1
|
|
14
|
+
with:
|
|
15
|
+
# Make sure you set the MOPS_IDENTITY_PEM secret in your repository settings https://docs.github.com/en/actions/security-guides/using-secrets-in-github-actions#creating-secrets-for-a-repository
|
|
16
|
+
identity-pem: ${{ secrets.MOPS_IDENTITY_PEM }}
|
|
17
|
+
- run: mops publish
|
package/templates/mops-test.yml
CHANGED
|
@@ -12,19 +12,11 @@ jobs:
|
|
|
12
12
|
runs-on: ubuntu-latest
|
|
13
13
|
|
|
14
14
|
steps:
|
|
15
|
-
- uses: actions/checkout@
|
|
16
|
-
- uses:
|
|
17
|
-
with:
|
|
18
|
-
node-version: 20
|
|
15
|
+
- uses: actions/checkout@v4
|
|
16
|
+
- uses: ZenVoich/setup-mops@v1
|
|
19
17
|
|
|
20
|
-
- name:
|
|
21
|
-
run:
|
|
22
|
-
|
|
23
|
-
- name: install mops packages
|
|
24
|
-
run: mops install
|
|
25
|
-
|
|
26
|
-
- name: install moc
|
|
27
|
-
run: mops toolchain use moc latest
|
|
18
|
+
- name: make sure moc is installed
|
|
19
|
+
run: mops toolchain bin moc || mops toolchain use moc latest
|
|
28
20
|
|
|
29
21
|
- name: run tests
|
|
30
22
|
run: mops test
|