Skip to content

Commit 57e16d9

Browse files
author
Nico Sammito
authored
Merge pull request #57 from code0-tech/feat/versioning
Versioning of sculptor and Pictor
2 parents 7f2dc3f + ecfee1c commit 57e16d9

6 files changed

Lines changed: 30 additions & 21 deletions

File tree

.env.local

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
EDITION=ce
2+
SAGITTARIUS_GRAPHQL_URL=http://localhost:3010/graphql
3+
NEXT_PUBLIC_SCULPTOR_VERSION=0.0.0
4+
NEXT_PUBLIC_PICTOR_VERSION=0.0.0-mvp.45

edition.mjs

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
// scripts/set-edition.mjs
21
import fs from "node:fs";
32
import path from "node:path";
43

@@ -23,3 +22,21 @@ tsconf.compilerOptions.paths['@edition/*'] = editionImports[edition];
2322
fs.writeFileSync(tsconfig, JSON.stringify(tsconf, null, 2));
2423

2524
console.log(`[set-edition] current -> ${edition}`);
25+
26+
const lockPath = path.join(root, 'package-lock.json');
27+
const lock = JSON.parse(fs.readFileSync(lockPath, 'utf-8'));
28+
const sculptorVersion = (lock.packages && lock.packages[""].version) || '0.0.0';
29+
const pictorVersion = (lock.packages && lock.packages["node_modules/@code0-tech/pictor"] && lock.packages["node_modules/@code0-tech/pictor"].version) || '0.0.0';
30+
31+
const envPath = path.join(root, '.env.local');
32+
let envContent = '';
33+
try {
34+
envContent = fs.readFileSync(envPath, 'utf-8');
35+
} catch (e) {}
36+
37+
envContent = envContent
38+
.replace(/^NEXT_PUBLIC_SCULPTOR_VERSION=.*$/m, `NEXT_PUBLIC_SCULPTOR_VERSION=${sculptorVersion}`)
39+
.replace(/^NEXT_PUBLIC_PICTOR_VERSION=.*$/m, `NEXT_PUBLIC_PICTOR_VERSION=${pictorVersion}`);
40+
41+
fs.writeFileSync(envPath, envContent.trim(), 'utf-8');
42+
console.log(`[set-edition] Versions written to .env.local`);

next.config.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,6 @@ const nextConfig: NextConfig = {
3434
},
3535
]
3636
},
37-
env: {
38-
NEXT_PUBLIC_edition: EDITION,
39-
NEXT_PUBLIC_pictorVersion: "11"
40-
},
4137
reactStrictMode: true,
4238
reactCompiler: true,
4339
turbopack: {

package-lock.json

Lines changed: 4 additions & 12 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
2-
"name": "my-app",
3-
"version": "0.1.0",
2+
"name": "@code0-tech/sculptor",
3+
"version": "0.0.0",
44
"private": true,
55
"scripts": {
66
"predev": "node edition.mjs",

src/packages/ce/src/application/pages/ApplicationSettingsPage.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ export const ApplicationSettingsPage: React.FC = () => {
128128
<Text size={"md"} hierarchy={"primary"}>Sculptor version</Text>
129129
<Text size={"md"} hierarchy={"tertiary"}>Version of this application</Text>
130130
</Flex>
131-
<Badge color={"info"}>v0.0.0-mvp.1</Badge>
131+
<Badge color={"info"}>{process.env.NEXT_PUBLIC_SCULPTOR_VERSION}</Badge>
132132
</Flex>
133133
</CardSection>
134134

@@ -140,7 +140,7 @@ export const ApplicationSettingsPage: React.FC = () => {
140140
library</Text>
141141
</Flex>
142142
<Badge
143-
color={"info"}>v0.0.0-mvp.10</Badge>
143+
color={"info"}>{process.env.NEXT_PUBLIC_PICTOR_VERSION}</Badge>
144144
</Flex>
145145
</CardSection>
146146
<CardSection border>

0 commit comments

Comments
 (0)