@widgetic/dev-tools 0.3.3 → 0.3.5
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/CHANGELOG.md +6 -1
- package/LICENSE +122 -0
- package/README.md +5 -1
- package/bin/publish-all-to-npm.mjs +2 -3
- package/bin/publish-package.mjs +178 -0
- package/lib/publish-to-npm.mjs +3 -3
- package/package.json +3 -3
- package/test/publish-to-npm.test.mjs +11 -13
package/CHANGELOG.md
CHANGED
|
@@ -7,9 +7,14 @@ reasons matter more than the categories.
|
|
|
7
7
|
|
|
8
8
|
### Added
|
|
9
9
|
|
|
10
|
-
- **`publish-
|
|
10
|
+
- **`publish-package.mjs`** (`bin/publish-package.mjs`): the laptop publish for every package. Each package's `publish-to-npm` script only calls this file. It does nothing when the latest commit already wrote the current version. Otherwise it raises the patch, publishes, commits the version files, tags the commit `v` plus the version, and pushes both. ui-sdk also releases the modules, and the tag is pushed after that release. embed-sdk also uploads its CDN file. dev-tools runs its tests before the version changes.
|
|
11
|
+
- **`publish-all-to-npm`** (`bin/publish-all-to-npm.mjs`): walks the npm packages and runs each package's `publish-to-npm` script.
|
|
11
12
|
- The README contract no longer checks `recorder` or `__template__`. The linking tier is `embed-sdk` and `ui-sdk`. The adopter tier is the apps that compile sibling source.
|
|
12
13
|
|
|
14
|
+
### Changed
|
|
15
|
+
|
|
16
|
+
- **The license is the Widgetic Integration License** (`LICENSE`, and `SEE LICENSE IN LICENSE` in `package.json`), not MIT: a partner may use the package to integrate Widgetic, and for nothing else. A version published before this change stays under the license it was published with.
|
|
17
|
+
|
|
13
18
|
## 0.3.1 — 2026-10-08
|
|
14
19
|
|
|
15
20
|
### Added
|
package/LICENSE
ADDED
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
Widgetic Integration License
|
|
2
|
+
Version 1.0
|
|
3
|
+
|
|
4
|
+
Copyright (c) Widgetic. All rights reserved.
|
|
5
|
+
|
|
6
|
+
This license covers the software package that it came with, in source and
|
|
7
|
+
compiled form, together with its documentation (the "Software"). By
|
|
8
|
+
installing, copying or using the Software you accept this license. If you do
|
|
9
|
+
not accept it, do not install or use the Software.
|
|
10
|
+
|
|
11
|
+
In this license, "Widgetic" is the company that publishes the Software, "you"
|
|
12
|
+
is the person or organization that uses it, and "Your Application" is an
|
|
13
|
+
application, website, product or service that you build or operate, for
|
|
14
|
+
yourself or for a client. "Widgetic Services" are the services that Widgetic
|
|
15
|
+
operates: the Widgetic API, widgets, compositions, embeds, editors, file
|
|
16
|
+
browser, chat and AI creator, and the other services that can be reached from
|
|
17
|
+
widgetic.com or its API hosts.
|
|
18
|
+
|
|
19
|
+
1. What you may do
|
|
20
|
+
|
|
21
|
+
Widgetic grants you a worldwide, non-exclusive, non-transferable and
|
|
22
|
+
non-sublicensable license to use the Software, unmodified, for one purpose: to
|
|
23
|
+
integrate the Widgetic Services into Your Application. Within that purpose you
|
|
24
|
+
may:
|
|
25
|
+
|
|
26
|
+
(a) install the Software and run it in Your Application, in development,
|
|
27
|
+
testing and production;
|
|
28
|
+
|
|
29
|
+
(b) use it to call the Widgetic API, to show Widgetic widgets and
|
|
30
|
+
compositions, and to open Widgetic's editors, file browser, chat and AI
|
|
31
|
+
creator inside Your Application;
|
|
32
|
+
|
|
33
|
+
(c) bundle, minify and tree-shake the Software with the build tools of Your
|
|
34
|
+
Application, deliver the result to the people who use Your Application as a
|
|
35
|
+
part of it, and let them run it there;
|
|
36
|
+
|
|
37
|
+
(d) keep the copies of the Software that (a), (b) and (c) need, including
|
|
38
|
+
copies in your version control, your build systems and your backups.
|
|
39
|
+
|
|
40
|
+
2. What you may not do
|
|
41
|
+
|
|
42
|
+
You may not, and may not allow anyone else to:
|
|
43
|
+
|
|
44
|
+
(a) use the Software for any purpose other than the one in section 1;
|
|
45
|
+
|
|
46
|
+
(b) use the Software to build, run or improve a service that offers what the
|
|
47
|
+
Widgetic Services offer, or to connect Your Application to anything other than
|
|
48
|
+
the Widgetic Services (a proxy of yours that forwards calls to the Widgetic
|
|
49
|
+
Services is fine);
|
|
50
|
+
|
|
51
|
+
(c) copy, modify, translate, adapt or make derivative works of the Software,
|
|
52
|
+
except as section 1(c) allows;
|
|
53
|
+
|
|
54
|
+
(d) publish, sell, rent, lease, sublicense or distribute the Software on its
|
|
55
|
+
own, or inside a library, SDK, template or product that others could use for
|
|
56
|
+
anything other than integrating the Widgetic Services, including by
|
|
57
|
+
publishing it, or a copy of it, to a package registry or a public CDN;
|
|
58
|
+
|
|
59
|
+
(e) reverse engineer, decompile or disassemble the Software, or try to get at
|
|
60
|
+
its source code, except as far as the law lets you despite this restriction;
|
|
61
|
+
|
|
62
|
+
(f) remove or change a copyright, license or attribution notice in the
|
|
63
|
+
Software;
|
|
64
|
+
|
|
65
|
+
(g) bypass, disable or interfere with the authentication, rate limits, quotas,
|
|
66
|
+
credits, plan limits or other protections of the Widgetic Services, or help
|
|
67
|
+
anyone else to;
|
|
68
|
+
|
|
69
|
+
(h) use the name, logo or trademarks of Widgetic, except to say truthfully
|
|
70
|
+
that Your Application integrates Widgetic.
|
|
71
|
+
|
|
72
|
+
3. The Widgetic Services are separate
|
|
73
|
+
|
|
74
|
+
This license is for the Software only. It does not give you the right to use
|
|
75
|
+
the Widgetic Services. That right comes from your account or agreement with
|
|
76
|
+
Widgetic and from Widgetic's Terms of Service (https://widgetic.com/terms),
|
|
77
|
+
which this license does not change.
|
|
78
|
+
|
|
79
|
+
4. Ownership
|
|
80
|
+
|
|
81
|
+
The Software is licensed to you, not sold. Widgetic and its licensors keep all
|
|
82
|
+
rights in it. Any right that this license does not give you in plain words is
|
|
83
|
+
reserved to Widgetic.
|
|
84
|
+
|
|
85
|
+
5. Third-party software
|
|
86
|
+
|
|
87
|
+
The Software may include or depend on software from others. That software is
|
|
88
|
+
under its own license, which applies to it instead of this one, and nothing in
|
|
89
|
+
this license limits your rights under it.
|
|
90
|
+
|
|
91
|
+
6. How long it lasts
|
|
92
|
+
|
|
93
|
+
This license lasts while you follow it and while you are entitled to use the
|
|
94
|
+
Widgetic Services. It ends on its own if you break it or that entitlement
|
|
95
|
+
ends. When it ends, you stop using the Software and delete your copies of it,
|
|
96
|
+
except copies that the law requires you to keep. Sections 4, 8 and 9 still
|
|
97
|
+
apply after it has ended.
|
|
98
|
+
|
|
99
|
+
7. Versions
|
|
100
|
+
|
|
101
|
+
This license applies to the version of the Software that it came with and to
|
|
102
|
+
later versions that carry it. A version that Widgetic published under another
|
|
103
|
+
license stays under that license, for the copies of it that you already have.
|
|
104
|
+
|
|
105
|
+
8. No warranty
|
|
106
|
+
|
|
107
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
108
|
+
IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
|
|
109
|
+
PURPOSE AND NON-INFRINGEMENT.
|
|
110
|
+
|
|
111
|
+
9. Limit of liability
|
|
112
|
+
|
|
113
|
+
TO THE EXTENT THE LAW ALLOWS, WIDGETIC IS NOT LIABLE FOR ANY INDIRECT,
|
|
114
|
+
INCIDENTAL, SPECIAL, CONSEQUENTIAL OR PUNITIVE DAMAGES, OR FOR LOST PROFITS,
|
|
115
|
+
REVENUE, DATA OR GOODWILL, THAT ARISE FROM THE SOFTWARE OR FROM THIS LICENSE,
|
|
116
|
+
EVEN IF IT HAS BEEN TOLD THAT THEY ARE POSSIBLE. NOTHING IN THIS LICENSE
|
|
117
|
+
LIMITS A LIABILITY THAT THE LAW DOES NOT ALLOW TO BE LIMITED.
|
|
118
|
+
|
|
119
|
+
10. Questions
|
|
120
|
+
|
|
121
|
+
If you need to do something that this license does not allow, ask first:
|
|
122
|
+
support@widgetic.com.
|
package/README.md
CHANGED
|
@@ -323,7 +323,7 @@ no longer make.
|
|
|
323
323
|
|
|
324
324
|
GitLab CI on `main` remains the way a package is published. When the group has no compute minutes left, the same publish can be done from this checkout.
|
|
325
325
|
|
|
326
|
-
Each package's `publish-to-npm` script
|
|
326
|
+
`bin/publish-package.mjs` is the publish for every package. Each package's `publish-to-npm` script only calls that file. It does nothing when the latest commit is the one that wrote the current `package.json` version. When a later commit exists, it raises the patch, publishes that version, commits the version files, tags that commit `v` plus the version, and pushes the commit and the tag. The token is the one in `~/.npmrc`. For ui-sdk it also keeps `SDK_VERSION` in step, then raises the modules patch and writes one changelog sentence. It commits before the modules release, because that release refuses a dirty `modules/` directory, and tags and pushes after the release. The R2 settings for the modules are in `modules/.env`, which is not committed. For embed-sdk it also uploads `dist/umd/embed-sdk.js` to the CDN and purges it, then commits the version and `dist/`, tags, and pushes. The R2 settings for that upload are in `.env.cdn`, which is not committed. The other packages have no CDN file. dev-tools runs its tests before the version changes.
|
|
327
327
|
|
|
328
328
|
From one package, publish only that package:
|
|
329
329
|
|
|
@@ -353,3 +353,7 @@ guard runs the full suite first; CI publishes with `--ignore-scripts`, which
|
|
|
353
353
|
skips that guard — the pipeline itself is the guard there).
|
|
354
354
|
|
|
355
355
|
Moving a consumer forward is then a devDependency bump.
|
|
356
|
+
|
|
357
|
+
## License
|
|
358
|
+
|
|
359
|
+
This package is licensed under the Widgetic Integration License (see the `LICENSE` file in the package): you may use it to integrate Widgetic into your own application, and for nothing else. It is not open source. For any other use, write to support@widgetic.com.
|
|
@@ -4,9 +4,8 @@
|
|
|
4
4
|
*
|
|
5
5
|
* npm run publish-all-to-npm
|
|
6
6
|
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
* embed-sdk also uploads its CDN file. This file only walks the checkouts.
|
|
7
|
+
* Each package.json calls bin/publish-package.mjs. That file is the publish.
|
|
8
|
+
* This file only walks the checkouts.
|
|
10
9
|
*/
|
|
11
10
|
|
|
12
11
|
import { spawnSync } from 'node:child_process';
|
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* Publish the package in the current directory.
|
|
4
|
+
*
|
|
5
|
+
* Each package's publish-to-npm script is only this file. embed-sdk also
|
|
6
|
+
* uploads its CDN file. ui-sdk also releases the modules. dev-tools runs its
|
|
7
|
+
* tests before the version changes. Every other package builds, or packages,
|
|
8
|
+
* then publishes.
|
|
9
|
+
*
|
|
10
|
+
* The script does nothing when the latest commit is the one that wrote the
|
|
11
|
+
* current package.json version. Otherwise it raises the patch, publishes,
|
|
12
|
+
* commits the version files, tags that commit v plus the version, and pushes
|
|
13
|
+
* the commit and the tag.
|
|
14
|
+
*/
|
|
15
|
+
|
|
16
|
+
import { spawnSync } from 'node:child_process';
|
|
17
|
+
import { existsSync, readFileSync, writeFileSync } from 'node:fs';
|
|
18
|
+
import { basename, join } from 'node:path';
|
|
19
|
+
|
|
20
|
+
const packageDir = process.cwd();
|
|
21
|
+
const packageName = basename(packageDir);
|
|
22
|
+
|
|
23
|
+
const BUILD_PACKAGES = new Set(['api-sdk', 'cache-layer', 'design-system']);
|
|
24
|
+
const PACKAGE_PACKAGES = new Set(['canvas', 'chat', 'editor', 'file-browser', 'widget-creator']);
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Run a command and stop the publish when it fails.
|
|
28
|
+
* @param {string} command
|
|
29
|
+
* @param {string[]} args
|
|
30
|
+
* @param {{ cwd?: string, env?: NodeJS.ProcessEnv }} [options]
|
|
31
|
+
*/
|
|
32
|
+
function run(command, args, options = {}) {
|
|
33
|
+
const result = spawnSync(command, args, {
|
|
34
|
+
cwd: options.cwd ?? packageDir,
|
|
35
|
+
env: options.env ?? process.env,
|
|
36
|
+
stdio: 'inherit'
|
|
37
|
+
});
|
|
38
|
+
if (result.status !== 0) {
|
|
39
|
+
console.error(`[publish-package] ${packageName}: ${command} ${args.join(' ')} exited ${result.status ?? 'without a status'}`);
|
|
40
|
+
process.exit(result.status ?? 1);
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* @param {string[]} args
|
|
46
|
+
* @returns {string}
|
|
47
|
+
*/
|
|
48
|
+
function gitOutput(args) {
|
|
49
|
+
return spawnSync('git', args, { cwd: packageDir, encoding: 'utf8' }).stdout.trim();
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
/** @returns {string} */
|
|
53
|
+
function readVersion() {
|
|
54
|
+
return JSON.parse(readFileSync(join(packageDir, 'package.json'), 'utf8')).version;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* The latest commit is the one that introduced this version string, so there
|
|
59
|
+
* is nothing new to publish.
|
|
60
|
+
* @param {string} version
|
|
61
|
+
* @returns {boolean}
|
|
62
|
+
*/
|
|
63
|
+
function versionCommitIsHead(version) {
|
|
64
|
+
const versionCommit = gitOutput(['log', '-1', '--format=%H', '-S', `"version": "${version}"`, '--', 'package.json']);
|
|
65
|
+
const head = gitOutput(['rev-parse', 'HEAD']);
|
|
66
|
+
return versionCommit !== '' && versionCommit === head;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
/**
|
|
70
|
+
* @param {string[]} paths
|
|
71
|
+
* @param {string} detail
|
|
72
|
+
*/
|
|
73
|
+
function commitVersion(paths, detail) {
|
|
74
|
+
const version = readVersion();
|
|
75
|
+
const present = paths.filter((path) => existsSync(join(packageDir, path)));
|
|
76
|
+
run('git', ['add', '--', ...present]);
|
|
77
|
+
run('git', ['commit', '-m', `chore: publish ${version}`, '-m', detail]);
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
function tagAndPush() {
|
|
81
|
+
const version = readVersion();
|
|
82
|
+
const tag = `v${version}`;
|
|
83
|
+
console.log(`[publish-package] ${packageName}: tagging ${tag}`);
|
|
84
|
+
run('git', ['tag', '-a', tag, '-m', tag]);
|
|
85
|
+
run('git', ['push', 'origin', 'HEAD', tag]);
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
function publishToNpm() {
|
|
89
|
+
// api-sdk is the internal client. The other packages are public.
|
|
90
|
+
const access = packageName === 'api-sdk' ? 'restricted' : 'public';
|
|
91
|
+
run('npm', ['publish', '--ignore-scripts', '--access', access]);
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
const currentVersion = readVersion();
|
|
95
|
+
if (versionCommitIsHead(currentVersion)) {
|
|
96
|
+
console.log(`[publish-package] ${packageName}: no commits since ${currentVersion}. Nothing to publish.`);
|
|
97
|
+
process.exit(0);
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
console.log(`[publish-package] ${packageName}: publishing the next patch after ${currentVersion}`);
|
|
101
|
+
|
|
102
|
+
if (packageName === 'dev-tools') {
|
|
103
|
+
run('npm', ['test']);
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
run('npm', ['version', 'patch', '--no-git-tag-version']);
|
|
107
|
+
|
|
108
|
+
if (BUILD_PACKAGES.has(packageName)) {
|
|
109
|
+
run('npm', ['run', 'build']);
|
|
110
|
+
publishToNpm();
|
|
111
|
+
commitVersion(
|
|
112
|
+
['package.json', 'package-lock.json'],
|
|
113
|
+
'- Record the patch that was just published to npm'
|
|
114
|
+
);
|
|
115
|
+
tagAndPush();
|
|
116
|
+
} else if (PACKAGE_PACKAGES.has(packageName)) {
|
|
117
|
+
run('npm', ['run', 'package']);
|
|
118
|
+
publishToNpm();
|
|
119
|
+
commitVersion(
|
|
120
|
+
['package.json', 'package-lock.json'],
|
|
121
|
+
'- Record the patch that was just published to npm'
|
|
122
|
+
);
|
|
123
|
+
tagAndPush();
|
|
124
|
+
} else if (packageName === 'dev-tools') {
|
|
125
|
+
publishToNpm();
|
|
126
|
+
commitVersion(
|
|
127
|
+
['package.json', 'package-lock.json'],
|
|
128
|
+
'- Record the patch that was just published to npm'
|
|
129
|
+
);
|
|
130
|
+
tagAndPush();
|
|
131
|
+
} else if (packageName === 'embed-sdk') {
|
|
132
|
+
run('npm', ['run', 'build']);
|
|
133
|
+
run('npm', ['run', 'check:no-secrets']);
|
|
134
|
+
publishToNpm();
|
|
135
|
+
run('npm', ['run', 'publish:cdn', '--', '--yes', '--purge', '--allow-dirty', '--env-file', '.env.cdn']);
|
|
136
|
+
commitVersion(
|
|
137
|
+
['package.json', 'package-lock.json', 'dist'],
|
|
138
|
+
'- Record the patch that was just published to npm and the CDN file built from it'
|
|
139
|
+
);
|
|
140
|
+
tagAndPush();
|
|
141
|
+
} else if (packageName === 'ui-sdk') {
|
|
142
|
+
const versionFile = join(packageDir, 'src/sdk/version.ts');
|
|
143
|
+
const version = readVersion();
|
|
144
|
+
writeFileSync(
|
|
145
|
+
versionFile,
|
|
146
|
+
readFileSync(versionFile, 'utf8').replace(/SDK_VERSION = '[^']+'/, `SDK_VERSION = '${version}'`)
|
|
147
|
+
);
|
|
148
|
+
run('npm', ['run', 'build:publish']);
|
|
149
|
+
run('node', ['scripts-sdk/check-no-secrets.js']);
|
|
150
|
+
publishToNpm();
|
|
151
|
+
run('node', ['modules/scripts/advance-module-version.mjs']);
|
|
152
|
+
commitVersion(
|
|
153
|
+
[
|
|
154
|
+
'package.json',
|
|
155
|
+
'package-lock.json',
|
|
156
|
+
'src/sdk/version.ts',
|
|
157
|
+
'modules/package.json',
|
|
158
|
+
'modules/package-lock.json',
|
|
159
|
+
'modules/src/composition-editor/CHANGELOG.md',
|
|
160
|
+
'modules/src/file-browser/CHANGELOG.md',
|
|
161
|
+
'modules/src/widget-creator/CHANGELOG.md'
|
|
162
|
+
],
|
|
163
|
+
'- Record the package patch and the modules patch that were just published'
|
|
164
|
+
);
|
|
165
|
+
const modulesDir = join(packageDir, 'modules');
|
|
166
|
+
const modulesVersion = JSON.parse(readFileSync(join(modulesDir, 'package.json'), 'utf8')).version;
|
|
167
|
+
const modulesTag = `modules-v${modulesVersion}`;
|
|
168
|
+
run('npm', ['run', 'release:check', '--', '--tag', modulesTag], { cwd: modulesDir });
|
|
169
|
+
run('npm', ['run', 'build'], {
|
|
170
|
+
cwd: modulesDir,
|
|
171
|
+
env: { ...process.env, NODE_OPTIONS: '--max-old-space-size=8192' }
|
|
172
|
+
});
|
|
173
|
+
run('npm', ['run', 'release:publish', '--', '--tag', modulesTag], { cwd: modulesDir });
|
|
174
|
+
tagAndPush();
|
|
175
|
+
} else {
|
|
176
|
+
console.error(`[publish-package] ${packageName} is not one of the packages this script publishes`);
|
|
177
|
+
process.exit(1);
|
|
178
|
+
}
|
package/lib/publish-to-npm.mjs
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* The Frontend checkouts whose `npm run publish-to-npm` publishes that package.
|
|
3
3
|
*
|
|
4
|
-
* `publish-all-to-npm`
|
|
5
|
-
*
|
|
6
|
-
* app, not a package on npm.
|
|
4
|
+
* `publish-all-to-npm` walks this list and runs that script. The script calls
|
|
5
|
+
* `bin/publish-package.mjs`, which is the publish for every package. `site`
|
|
6
|
+
* is absent because it is an app, not a package on npm.
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
9
|
/** @typedef {{ dir: string, script: string }} PublishablePackage */
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@widgetic/dev-tools",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.5",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Build-time checks and dev tooling shared by the published @widgetic packages, released once so the repositories that consume them cannot drift apart. Currently: check-runtime-deps (with the fixture suite that proves it fails), the Vite sibling-$lib remap, the canonical Frontend sibling layout that builds every consumer's dev-alias tables, and check-links — the link-doctor that fails when a sibling symlink dangles, a promised dist/ file is missing, or a dead checkout name lingers, and check-design-system-peers — which fails when the two design-system peers' lockfiles drift apart.",
|
|
6
6
|
"repository": {
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
"publishConfig": {
|
|
11
11
|
"access": "public"
|
|
12
12
|
},
|
|
13
|
-
"license": "
|
|
13
|
+
"license": "SEE LICENSE IN LICENSE",
|
|
14
14
|
"engines": {
|
|
15
15
|
"node": ">=20"
|
|
16
16
|
},
|
|
@@ -45,7 +45,7 @@
|
|
|
45
45
|
"test:peers": "node --test test/lockfile-peers.test.mjs",
|
|
46
46
|
"test:publish": "node --test test/publish-to-npm.test.mjs",
|
|
47
47
|
"test": "npm run check:deps && npm run test:deps && npm run test:vite && npm run test:layout && npm run test:links && npm run test:readme && npm run test:peers && npm run test:publish",
|
|
48
|
-
"publish-to-npm": "
|
|
48
|
+
"publish-to-npm": "node bin/publish-package.mjs",
|
|
49
49
|
"publish-all-to-npm": "node bin/publish-all-to-npm.mjs",
|
|
50
50
|
"prepublishOnly": "npm test"
|
|
51
51
|
},
|
|
@@ -27,23 +27,21 @@ test('the walk calls publish-to-npm in each npm package', () => {
|
|
|
27
27
|
assert.equal(PUBLISHABLE_PACKAGES.some((pkg) => pkg.dir === 'site'), false);
|
|
28
28
|
});
|
|
29
29
|
|
|
30
|
-
test('each package script
|
|
30
|
+
test('each package script calls the one publisher, and the walk is separate', () => {
|
|
31
|
+
const publisher = readFileSync(resolve(FRONTEND, 'dev-tools/bin/publish-package.mjs'), 'utf8');
|
|
32
|
+
assert.equal(publisher.includes('no commits since'), true);
|
|
33
|
+
assert.equal(publisher.includes("['tag', '-a', tag, '-m', tag]"), true);
|
|
34
|
+
assert.equal(publisher.includes('publish:cdn'), true);
|
|
35
|
+
assert.equal(publisher.includes('advance-module-version.mjs'), true);
|
|
36
|
+
assert.equal(publisher.indexOf('commitVersion(') < publisher.indexOf('release:publish'), true);
|
|
31
37
|
for (const pkg of PUBLISHABLE_PACKAGES) {
|
|
32
38
|
const manifest = JSON.parse(readFileSync(resolve(FRONTEND, pkg.dir, 'package.json'), 'utf8'));
|
|
33
39
|
const command = manifest.scripts?.[pkg.script];
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
assert.equal(command
|
|
38
|
-
assert.equal(command.includes('git push origin HEAD'), true, `${pkg.dir} does not push the version`);
|
|
39
|
-
assert.equal(command.includes('publish-all-to-npm'), false, `${pkg.dir} script is the walk`);
|
|
40
|
+
const expected = pkg.dir === 'dev-tools'
|
|
41
|
+
? 'node bin/publish-package.mjs'
|
|
42
|
+
: 'node ../dev-tools/bin/publish-package.mjs';
|
|
43
|
+
assert.equal(command, expected, `${pkg.dir} does not call the shared publisher`);
|
|
40
44
|
}
|
|
41
|
-
const uiSdk = JSON.parse(readFileSync(resolve(FRONTEND, 'ui-sdk/package.json'), 'utf8'));
|
|
42
|
-
assert.equal(uiSdk.scripts['publish-to-npm'].indexOf('git commit') < uiSdk.scripts['publish-to-npm'].indexOf('release:publish'), true);
|
|
43
|
-
assert.equal(uiSdk.scripts['publish-to-npm'].includes('advance-module-version.mjs'), true);
|
|
44
|
-
assert.equal(uiSdk.scripts['publish-to-npm'].includes('release:publish'), true);
|
|
45
|
-
const embed = JSON.parse(readFileSync(resolve(FRONTEND, 'embed-sdk/package.json'), 'utf8'));
|
|
46
|
-
assert.equal(embed.scripts['publish-to-npm'].includes('publish:cdn'), true);
|
|
47
45
|
const devTools = JSON.parse(readFileSync(resolve(FRONTEND, 'dev-tools/package.json'), 'utf8'));
|
|
48
46
|
assert.equal(devTools.scripts['publish-all-to-npm'], 'node bin/publish-all-to-npm.mjs');
|
|
49
47
|
});
|