@pantheon-systems/create-p1-starter-kit 0.11.0 → 0.12.0
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/lib/copy-template.js
CHANGED
|
@@ -9,6 +9,11 @@ export function getTemplatePath() {
|
|
|
9
9
|
return path.join(__dirname, '..', 'template');
|
|
10
10
|
}
|
|
11
11
|
|
|
12
|
+
export function getScaffolderVersion() {
|
|
13
|
+
const pkgPath = path.join(__dirname, '..', 'package.json');
|
|
14
|
+
return JSON.parse(fs.readFileSync(pkgPath, 'utf-8')).version;
|
|
15
|
+
}
|
|
16
|
+
|
|
12
17
|
export function copyTemplate(targetDir, projectName) {
|
|
13
18
|
const templatePath = getTemplatePath();
|
|
14
19
|
|
|
@@ -18,7 +23,7 @@ export function copyTemplate(targetDir, projectName) {
|
|
|
18
23
|
|
|
19
24
|
copyRecursive(templatePath, targetDir);
|
|
20
25
|
|
|
21
|
-
//
|
|
26
|
+
// Stamp the project name and scaffolder version into package.json
|
|
22
27
|
const packageJsonPath = path.join(targetDir, 'package.json');
|
|
23
28
|
let packageJson;
|
|
24
29
|
try {
|
|
@@ -27,6 +32,7 @@ export function copyTemplate(targetDir, projectName) {
|
|
|
27
32
|
throw new Error(`Failed to parse package.json: ${error.message}`);
|
|
28
33
|
}
|
|
29
34
|
packageJson.name = projectName;
|
|
35
|
+
packageJson.p1 = { ...packageJson.p1, templateVersion: getScaffolderVersion() };
|
|
30
36
|
fs.writeFileSync(packageJsonPath, JSON.stringify(packageJson, null, 2) + '\n');
|
|
31
37
|
}
|
|
32
38
|
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import fs from 'fs';
|
|
2
|
+
import os from 'os';
|
|
3
|
+
import path from 'path';
|
|
4
|
+
import { describe, it, expect, beforeEach, afterEach } from 'vitest';
|
|
5
|
+
import { copyTemplate, getScaffolderVersion } from './copy-template.js';
|
|
6
|
+
|
|
7
|
+
describe('copyTemplate', () => {
|
|
8
|
+
let targetDir;
|
|
9
|
+
|
|
10
|
+
beforeEach(() => {
|
|
11
|
+
targetDir = path.join(fs.mkdtempSync(path.join(os.tmpdir(), 'scaffold-')), 'my-app');
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
afterEach(() => {
|
|
15
|
+
fs.rmSync(path.dirname(targetDir), { recursive: true, force: true });
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
it('stamps the project name and scaffolder version into package.json', () => {
|
|
19
|
+
copyTemplate(targetDir, 'my-app');
|
|
20
|
+
|
|
21
|
+
const pkg = JSON.parse(fs.readFileSync(path.join(targetDir, 'package.json'), 'utf-8'));
|
|
22
|
+
expect(pkg.name).toBe('my-app');
|
|
23
|
+
expect(pkg.p1.templateVersion).toBe(getScaffolderVersion());
|
|
24
|
+
});
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
describe('getScaffolderVersion', () => {
|
|
28
|
+
it('returns the version from this package manifest', () => {
|
|
29
|
+
const manifest = JSON.parse(
|
|
30
|
+
fs.readFileSync(new URL('../package.json', import.meta.url), 'utf-8')
|
|
31
|
+
);
|
|
32
|
+
expect(getScaffolderVersion()).toBe(manifest.version);
|
|
33
|
+
});
|
|
34
|
+
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pantheon-systems/create-p1-starter-kit",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.12.0",
|
|
4
4
|
"description": "Scaffold a new P1 starter project",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -38,15 +38,15 @@
|
|
|
38
38
|
"isomorphic-dompurify": "^3.18.0",
|
|
39
39
|
"react": "^19.2.5",
|
|
40
40
|
"vitest": "^4.1.5",
|
|
41
|
-
"@pantheon-systems/css-client": "0.
|
|
41
|
+
"@pantheon-systems/css-client": "0.12.0",
|
|
42
42
|
"@pantheon-systems/eslint-config": "0.1.0",
|
|
43
|
-
"@pantheon-systems/puck-css": "0.
|
|
43
|
+
"@pantheon-systems/puck-css": "0.12.0"
|
|
44
44
|
},
|
|
45
45
|
"dependencies": {
|
|
46
46
|
"@clack/prompts": "^1.5.1",
|
|
47
47
|
"picocolors": "^1.1.1"
|
|
48
48
|
},
|
|
49
|
-
"license": "
|
|
49
|
+
"license": "UNLICENSED",
|
|
50
50
|
"homepage": "https://github.com/pantheon-systems/p1-platform/tree/main/packages/create-p1-starter-kit",
|
|
51
51
|
"scripts": {
|
|
52
52
|
"build": "node scripts/build-template.js",
|
package/template/app/styles.css
CHANGED
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
@import "tailwindcss";
|
|
2
2
|
@plugin "@tailwindcss/typography";
|
|
3
|
-
|
|
3
|
+
/* Tailwind must scan puck-css's own components for the utility classes they use.
|
|
4
|
+
node_modules-relative so the same path resolves in this monorepo (pnpm symlink)
|
|
5
|
+
and in a scaffolded project; dist rather than src because the published package
|
|
6
|
+
ships only compiled output. */
|
|
7
|
+
@source "../node_modules/@pantheon-systems/puck-css/dist";
|
|
4
8
|
|
|
5
9
|
/* Scoped via :has() rather than a bare `body {...}` selector so this reset
|
|
6
10
|
stays out of Puck's canvas-preview iframe (PCC-3499 / PCC-3513).
|
package/template/package.json
CHANGED
|
@@ -15,12 +15,12 @@
|
|
|
15
15
|
},
|
|
16
16
|
"dependencies": {
|
|
17
17
|
"@pantheon-systems/cpub-react-sdk": "^5.2.1",
|
|
18
|
-
"@pantheon-systems/css-client": "^0.
|
|
19
|
-
"@pantheon-systems/p1-ai-chat": "^0.5.
|
|
18
|
+
"@pantheon-systems/css-client": "^0.12.0",
|
|
19
|
+
"@pantheon-systems/p1-ai-chat": "^0.5.1",
|
|
20
20
|
"@pantheon-systems/p1-media": "^0.4.4",
|
|
21
|
-
"@pantheon-systems/p1-next-sdk": "^0.
|
|
21
|
+
"@pantheon-systems/p1-next-sdk": "^0.12.0",
|
|
22
22
|
"@pantheon-systems/pds-toolkit-react": "2.0.0-alpha.66",
|
|
23
|
-
"@pantheon-systems/puck-css": "^0.
|
|
23
|
+
"@pantheon-systems/puck-css": "^0.12.0",
|
|
24
24
|
"@puckeditor/core": "^0.21.1",
|
|
25
25
|
"@tailwindcss/postcss": "^4.2.2",
|
|
26
26
|
"@tailwindcss/typography": "^0.5.16",
|