Skip to content

Commit

Permalink
feat(storefront): strf-10292 Node 16 Support (#1048)
Browse files Browse the repository at this point in the history
BREAKING CHANGE: Drop Node 14 Support
  • Loading branch information
jairo-bc committed Mar 30, 2023
1 parent 108c5dc commit c754933
Show file tree
Hide file tree
Showing 13 changed files with 29,371 additions and 11,645 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/pull_request_review.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
build:
strategy:
matrix:
node: [14.x]
node: [16.x]
os: ['ubuntu-latest', 'windows-2019', 'macos-latest']

runs-on: ${{ matrix.os }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: '14.x'
node-version: '16.x'
- run: npm i
- name: Check Git Commit name
run: git log -1 --pretty=format:"%s" | npx commitlint
Expand Down
2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v14.19
v16.19
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM node:14
FROM node:16

WORKDIR /usr/src/app

Expand Down
5 changes: 2 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,8 @@ The BigCommerce server emulator for local theme development.

## Install

_Note: Stencil requires the Node.js runtime environment,
version 14.x is supported.
We do not yet have support for versions greater than Node 14._
Note: Stencil requires the Node.js runtime environment,
version 16.x is supported.

Run `npm install -g @bigcommerce/stencil-cli`.

Expand Down
8 changes: 0 additions & 8 deletions lib/StencilCLISettings.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,6 @@ class StencilCLISettings {
isVerbose() {
return this.versboseNetworkLogging;
}

useOldNodeSassFork(flag) {
this.oldNodeSassFork = flag;
}

isOldNodeSassForkEnabled() {
return this.oldNodeSassFork;
}
}

const settings = new StencilCLISettings();
Expand Down
25 changes: 7 additions & 18 deletions lib/bundle-validator.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ const privateThemeConfigValidationSchema = require('./schemas/privateThemeConfig
const themeConfigValidationSchema = require('./schemas/themeConfig.json');
const themeValidationSchema = require('./schemas/themeSchema.json');
const cssCompiler = require('./css/compile');
const stencilCLISettings = require('./StencilCLISettings');

const VALID_IMAGE_TYPES = ['.jpg', '.jpeg', '.png', '.gif'];
const WIDTH_COMPOSED = 600;
Expand Down Expand Up @@ -415,26 +414,16 @@ class BundleValidator {

for (const file of cssFiles) {
try {
const engine = stencilCLISettings.isOldNodeSassForkEnabled()
? cssCompiler.FALLBACK_SASS_ENGINE_NAME
: cssCompiler.SASS_ENGINE_NAME;
/* eslint-disable-next-line no-await-in-loop */
await cssCompiler.compile(rawConfig, assetsPath, file, engine);
const r = await cssCompiler.compile(
rawConfig,
assetsPath,
file,
cssCompiler.SASS_ENGINE_NAME,
);
console.log(r);
} catch (e) {
const message = this.parseStencilStylesError(e);
if (!stencilCLISettings.isOldNodeSassForkEnabled()) {
throw new Error(
`${message}\n`.red +
`\n` +
`---------WARNING---------\n`.red +
`We are currently in the process of deprecating node-sass fork https:/bigcommerce-labs/node-sass\n` +
`Your scss files were compiled using latest node-sass version https:/sass/node-sass\n` +
`This error might indicate that your scss file is not compatible with it.\n` +
`There is still an option to compile scss file old fork by using --use-old-node-sass-fork.\n` +
`But note, that this will lead to 500 error in production in near future.\n` +
`---------WARNING---------\n`.red,
);
}
throw new Error(
`${message} while compiling css files from "${stylesPath}/${file}".`.red,
);
Expand Down
2 changes: 0 additions & 2 deletions lib/bundle-validator.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ const { promisify } = require('util');

const ThemeConfig = require('./theme-config');
const BundleValidator = require('./bundle-validator');
const stencilCLISettings = require('./StencilCLISettings');

const themePath = path.join(process.cwd(), 'test/_mocks/themes/valid');

Expand All @@ -16,7 +15,6 @@ describe('BundleValidator', () => {

afterEach(() => {
jest.restoreAllMocks();
stencilCLISettings.useOldNodeSassFork(false);
});

it('should not run image validations for private themes', async () => {
Expand Down
32 changes: 0 additions & 32 deletions lib/bundle-validator2.spec.js

This file was deleted.

1 change: 0 additions & 1 deletion lib/cliCommon.js
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,6 @@ function applyCommonOptions(program) {

function setupCLI(options) {
stencilCLISettings.setVerbose(options.verbose);
stencilCLISettings.useOldNodeSassFork(options.useOldNodeSassFork);
}

function prepareCommand(program) {
Expand Down
4 changes: 1 addition & 3 deletions lib/css/compile.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ const { promisify } = require('util');

const cssAssembler = require('../css-assembler');

const FALLBACK_SASS_ENGINE_NAME = 'node-sass-fork';
const SASS_ENGINE_NAME = 'node-sass';

const compile = async (configuration, themeAssetsPath, fileName, engineName = SASS_ENGINE_NAME) => {
Expand All @@ -29,7 +28,7 @@ const compile = async (configuration, themeAssetsPath, fileName, engineName = SA
sourceMap: true,
autoprefixerOptions: {
cascade: configuration.autoprefixer_cascade,
browsers: configuration.autoprefixer_browsers,
overrideBrowserslist: configuration.autoprefixer_browsers,
},
};
const stencilStyles = new StencilStyles(console);
Expand All @@ -41,5 +40,4 @@ const compile = async (configuration, themeAssetsPath, fileName, engineName = SA
module.exports = {
compile,
SASS_ENGINE_NAME,
FALLBACK_SASS_ENGINE_NAME,
};
Loading

0 comments on commit c754933

Please sign in to comment.