Skip to content

Commit

Permalink
[Chore] Release process, maintenance simplification (#1967) [skip ci]
Browse files Browse the repository at this point in the history
  • Loading branch information
illiakovalenko authored Nov 27, 2024
1 parent 283392b commit f41f96c
Show file tree
Hide file tree
Showing 14 changed files with 120 additions and 43 deletions.
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,9 @@ To create a JSS project for an older version of JSS and Sitecore:

## Documentation and community resources

- [Official JSS documentation](https://doc.sitecore.com/xp/en/developers/hd/200/sitecore-headless-development/sitecore-javascript-rendering-sdks--jss-.html)
- Official JSS documentation:
- [XM Cloud](https://doc.sitecore.com/xmc/en/developers/jss/latest/jss-xmc/index-en.html)
- [XP](https://doc.sitecore.com/xp/en/developers/hd/latest/sitecore-headless-development/sitecore-javascript-rendering-sdks--jss-.html)
- [StackExchange](https://sitecore.stackexchange.com/)
- [Community Slack](https://sitecorechat.slack.com/messages/jss)
- [Sitecore Community Forum](https://community.sitecore.net/developers/f/40)
Expand Down
4 changes: 0 additions & 4 deletions docs/upgrades/21.8.md

This file was deleted.

2 changes: 2 additions & 0 deletions packages/create-sitecore-jss/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@
"@types/minimist": "^1.2.2",
"@types/mocha": "^10.0.1",
"@types/node": "^18.11.18",
"@types/proxyquire": "^1.3.31",
"@types/sinon": "17.0.2",
"@types/sinon-chai": "^3.2.9",
"chai": "^4.3.7",
Expand All @@ -58,6 +59,7 @@
"eslint": "^8.32.0",
"mocha": "^10.2.0",
"nyc": "^15.1.0",
"proxyquire": "^2.1.3",
"sinon": "^15.0.1",
"sinon-chai": "^3.7.0",
"ts-node": "^10.9.1",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import ejs from 'ejs';
import glob from 'glob';
import { expect } from 'chai';
import sinon, { SinonStub } from 'sinon';
import proxyquire from 'proxyquire';
import { currentPkg, partialPkg } from '../test-data/pkg';
import * as transform from './transform';
import * as helpers from '../utils/helpers';
Expand Down Expand Up @@ -507,7 +508,6 @@ describe('transform', () => {

globSyncStub = sinon.stub(glob, 'sync').returns([file]);
ejsRenderFileStub = sinon.stub(ejs, 'renderFile').returns(Promise.resolve(renderFileOutput));
diffAndWriteFilesStub = sinon.stub(transform, 'diffAndWriteFiles');

const answers = {
destination: destinationPath,
Expand All @@ -516,10 +516,17 @@ describe('transform', () => {
force: false,
};

await transformFunc(templatePath, answers);
const transformModule = proxyquire('./transform', {
'../../../package.json': { version: '22.2.1-canary.33' },
});

diffAndWriteFilesStub = sinon.stub(transformModule, 'diffAndWriteFiles');

await transformModule.transform(templatePath, answers);

expect(ejsRenderFileStub).to.have.been.calledOnceWith(path.join(templatePath, file), {
...answers,
version: '22.2.1-canary',
helper: {
isDev: false,
getPascalCaseName: helpers.getPascalCaseName,
Expand Down Expand Up @@ -629,8 +636,6 @@ describe('transform', () => {
fsExistsSyncStub = sinon.stub(fs, 'existsSync').returns(true);
openPackageJsonStub = sinon.stub(helpers, 'openPackageJson').returns(currentPkg);
ejsRenderFileStub = sinon.stub(ejs, 'renderFile').returns(Promise.resolve(renderFileOutput));
mergeStub = sinon.stub(transform, 'merge').returns(mergedPkg);
diffAndWriteFilesStub = sinon.stub(transform, 'diffAndWriteFiles');

const answers = {
destination: destinationPath,
Expand All @@ -639,10 +644,18 @@ describe('transform', () => {
force: false,
};

await transformFunc(templatePath, answers);
const transformModule = proxyquire('./transform', {
'../../../package.json': { version: '22.2.1-canary.33' },
});

diffAndWriteFilesStub = sinon.stub(transformModule, 'diffAndWriteFiles');
mergeStub = sinon.stub(transformModule, 'merge').returns(mergedPkg);

await transformModule.transform(templatePath, answers);

expect(ejsRenderFileStub).to.have.been.calledOnceWith(path.join(templatePath, file), {
...answers,
version: '22.2.1-canary',
helper: {
isDev: false,
getPascalCaseName: helpers.getPascalCaseName,
Expand All @@ -669,8 +682,13 @@ describe('transform', () => {
fsExistsSyncStub = sinon.stub(fs, 'existsSync').returns(true);
fsReadFileSunc = sinon.stub(fs, 'readFileSync').returns(currentDotEnv);
ejsRenderFileStub = sinon.stub(ejs, 'renderFile').returns(Promise.resolve(templateDotEnv));
mergeEnvStub = sinon.stub(transform, 'mergeEnv').returns(concatDotEnv);
diffAndWriteFilesStub = sinon.stub(transform, 'diffAndWriteFiles');

const transformModule = proxyquire('./transform', {
'../../../package.json': { version: '22.2.1-canary.33' },
});

mergeEnvStub = sinon.stub(transformModule, 'mergeEnv').returns(concatDotEnv);
diffAndWriteFilesStub = sinon.stub(transformModule, 'diffAndWriteFiles');

const answers = {
destination: destinationPath,
Expand All @@ -679,10 +697,11 @@ describe('transform', () => {
force: false,
};

await transformFunc(templatePath, answers);
await transformModule.transform(templatePath, answers);

expect(ejsRenderFileStub).to.have.been.calledOnceWith(path.join(templatePath, file), {
...answers,
version: '22.2.1-canary',
helper: {
isDev: false,
getPascalCaseName: helpers.getPascalCaseName,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import {
} from '../utils/helpers';
import { diffLines, diffJson, Change } from 'diff';
import { BaseArgs } from '../args/base';
const { version } = require('../../../package.json');

const FILE_FOR_COPY_REGEXP = /(index\.html)$|\.(gif|jpg|jpeg|tiff|png|svg|ashx|ico|pdf|jar|eot|woff|ttf|woff2)$/;

Expand Down Expand Up @@ -237,9 +238,15 @@ export const transform = async (
answers.appPrefix = false;
}

// Don't expose canary build number in the generated app
const jssVersion = version.includes('canary')
? version.replace(/(-canary\.\d+)$/, '-canary')
: version;

// pass in helper to answers object
const ejsData: Data = {
...answers,
version: jssVersion,
helper: {
isDev: isDevEnvironment(answers.destination),
getPascalCaseName: getPascalCaseName,
Expand Down
10 changes: 5 additions & 5 deletions packages/create-sitecore-jss/src/templates/angular/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "<%- appName %>",
"version": "21.8.1-canary",
"version": "<%- version %>",
"description": "Application utilizing Sitecore JavaScript Services and Angular (angular-cli).",
"config": {
"appName": "<%- appName %>",
Expand Down Expand Up @@ -60,7 +60,7 @@
"@apollo/client": "^3.3.12",
"@ngx-translate/core": "~15.0.0",
"@ngx-translate/http-loader": "~8.0.0",
"@sitecore-jss/sitecore-jss-angular": "~21.8.1-canary",
"@sitecore-jss/sitecore-jss-angular": "~<%- version %>",
"apollo-angular": "~6.0.0",
"bootstrap": "^5.3.3",
"core-js": "~3.37.1",
Expand All @@ -82,9 +82,9 @@
"@angular/cli": "~17.3.10",
"@angular/compiler-cli": "~17.3.12",
"@angular/language-service": "~17.3.12",
"@sitecore-jss/sitecore-jss-angular-schematics": "~21.8.1-canary",
"@sitecore-jss/sitecore-jss-cli": "~21.8.1-canary",
"@sitecore-jss/sitecore-jss-dev-tools": "~21.8.1-canary",
"@sitecore-jss/sitecore-jss-angular-schematics": "~<%- version %>",
"@sitecore-jss/sitecore-jss-cli": "~<%- version %>",
"@sitecore-jss/sitecore-jss-dev-tools": "~<%- version %>",
"@types/isomorphic-fetch": "0.0.35",
"@types/jasmine": "~3.6.7",
"@types/jasminewd2": "~2.0.8",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"nprogress": "~0.2.0"
},
"devDependencies": {
"@sitecore-jss/sitecore-jss-dev-tools": "~21.8.1-canary",
"@sitecore-jss/sitecore-jss-dev-tools": "~<%- version %>",
"@types/nprogress": "^0.2.0"
},
"scripts": {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "<%- appName %>",
"description": "Application utilizing Sitecore JavaScript Services and Next.js",
"version": "21.8.1-canary",
"version": "<%- version %>",
"private": true,
"config": {
"appName": "<%- appName %>",
Expand All @@ -25,7 +25,7 @@
},
"license": "Apache-2.0",
"dependencies": {
"@sitecore-jss/sitecore-jss-nextjs": "~21.8.1-canary",
"@sitecore-jss/sitecore-jss-nextjs": "~<%- version %>",
"graphql": "~15.8.0",
"graphql-tag": "^2.12.6",
"next": "^14.1.0",
Expand All @@ -42,8 +42,8 @@
"@graphql-codegen/typescript-operations": "^4.0.1",
"@graphql-codegen/typescript-resolvers": "^4.0.1",
"@graphql-typed-document-node/core": "^3.2.0",
"@sitecore-jss/sitecore-jss-cli": "~21.8.1-canary",
"@sitecore-jss/sitecore-jss-dev-tools": "~21.8.1-canary",
"@sitecore-jss/sitecore-jss-cli": "~<%- version %>",
"@sitecore-jss/sitecore-jss-dev-tools": "~<%- version %>",
"@types/node": "^18.11.18",
"@types/react": "^18.2.22",
"@types/react-dom": "^18.0.5",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "node-headless-ssr-experience-edge-sample",
"version": "21.8.1-canary",
"version": "<%- version %>",
"description": "Node server-side-rendering sample for running JSS apps under Node hosting using Experience Edge",
"scripts": {
"start": "ts-node ./src/index.ts"
Expand All @@ -19,7 +19,7 @@
"homepage": "https://jss.sitecore.com",
"license": "Apache-2.0",
"dependencies": {
"@sitecore-jss/sitecore-jss": "~21.8.1-canary",
"@sitecore-jss/sitecore-jss": "~<%- version %>",
"compression": "^1.7.4",
"express": "^4.18.2",
"dotenv": "^16.0.3"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "node-headless-ssr-proxy-sample",
"version": "21.8.1-canary",
"version": "<%- version %>",
"description": "Node server-side-rendering proxy sample for running JSS apps under Node hosting",
"scripts": {
"start": "ts-node ./src/index.ts"
Expand All @@ -19,8 +19,8 @@
"homepage": "https://jss.sitecore.com",
"license": "Apache-2.0",
"dependencies": {
"@sitecore-jss/sitecore-jss": "~21.8.1-canary",
"@sitecore-jss/sitecore-jss-proxy": "~21.8.1-canary",
"@sitecore-jss/sitecore-jss": "~<%- version %>",
"@sitecore-jss/sitecore-jss-proxy": "~<%- version %>",
"agentkeepalive": "^4.2.1",
"compression": "~1.7.4",
"express": "~4.18.2",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "<%- appName %>",
"version": "21.8.1-canary",
"version": "<%- version %>",
"description": "A basic React Native app utilizing Sitecore JavaScript Services",
"config": {
"appName": "<%- appName %>",
Expand All @@ -23,7 +23,7 @@
},
"dependencies": {
"@react-native-community/masked-view": "^0.1.10",
"@sitecore-jss/sitecore-jss-react-native": "~21.8.1-canary",
"@sitecore-jss/sitecore-jss-react-native": "~<%- version %>",
"prop-types": "^15.6.0",
"react": "16.13.1",
"react-native": "^0.63.4",
Expand All @@ -37,8 +37,8 @@
},
"private": true,
"devDependencies": {
"@sitecore-jss/sitecore-jss-cli": "~21.8.1-canary",
"@sitecore-jss/sitecore-jss-dev-tools": "~21.8.1-canary",
"@sitecore-jss/sitecore-jss-cli": "~<%- version %>",
"@sitecore-jss/sitecore-jss-dev-tools": "~<%- version %>",
"babel-core": "^6.26.0",
"babel-eslint": "^8.2.1",
"babel-plugin-inline-replace-variables": "^1.3.1",
Expand Down
10 changes: 5 additions & 5 deletions packages/create-sitecore-jss/src/templates/react/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "<%- appName %>",
"description": "Application utilizing Sitecore JavaScript Services and React (create-react-app).",
"version": "21.8.1-canary",
"version": "<%- version %>",
"private": true,
"config": {
"appName": "<%- appName %>",
Expand All @@ -28,7 +28,7 @@
"license": "Apache-2.0",
"dependencies": {
"@apollo/client": "^3.7.1",
"@sitecore-jss/sitecore-jss-react": "~21.8.1-canary",
"@sitecore-jss/sitecore-jss-react": "~<%- version %>",
"axios": "^1.2.0",
"bootstrap": "^5.2.3",
"cross-fetch": "^3.1.5",
Expand All @@ -53,9 +53,9 @@
"@babel/preset-env": "^7.20.2",
"@babel/preset-react": "^7.18.6",
"@babel/register": "~7.18.9",
"@sitecore-jss/sitecore-jss-cli": "~21.8.1-canary",
"@sitecore-jss/sitecore-jss-dev-tools": "~21.8.1-canary",
"@sitecore-jss/sitecore-jss-rendering-host": "~21.8.1-canary",
"@sitecore-jss/sitecore-jss-cli": "~<%- version %>",
"@sitecore-jss/sitecore-jss-dev-tools": "~<%- version %>",
"@sitecore-jss/sitecore-jss-rendering-host": "~<%- version %>",
"babel-loader": "~9.1.0",
"babel-preset-react-app": "~10.0.1",
"chalk": "~4.1.2",
Expand Down
8 changes: 4 additions & 4 deletions packages/create-sitecore-jss/src/templates/vue/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "<%- appName %>",
"version": "21.8.1-canary",
"version": "<%- version %>",
"description": "Application utilizing Sitecore JavaScript Services and Vue (vue-cli).",
"private": true,
"config": {
Expand Down Expand Up @@ -45,7 +45,7 @@
"dependencies": {
"@apollo/client": "^3.7.4",
"@panter/vue-i18next": "~0.15.2",
"@sitecore-jss/sitecore-jss-vue": "~21.8.1-canary",
"@sitecore-jss/sitecore-jss-vue": "~<%- version %>",
"@vue/apollo-composable": "4.0.0-beta.2",
"@vue/apollo-option": "^4.0.0-alpha.20",
"@vue/apollo-ssr": "^4.0.0-alpha.18",
Expand All @@ -64,8 +64,8 @@
"devDependencies": {
"@babel/eslint-parser": "^7.19.1",
"@babel/register": "7.18.9",
"@sitecore-jss/sitecore-jss-cli": "~21.8.1-canary",
"@sitecore-jss/sitecore-jss-dev-tools": "~21.8.1-canary",
"@sitecore-jss/sitecore-jss-cli": "~<%- version %>",
"@sitecore-jss/sitecore-jss-dev-tools": "~<%- version %>",
"@vue/cli-plugin-babel": "~5.0.8",
"@vue/cli-plugin-eslint": "~5.0.8",
"@vue/cli-service": "~5.0.8",
Expand Down
Loading

0 comments on commit f41f96c

Please sign in to comment.