scratch-render-fonts 1.0.0-prerelease.20231017225105 → 1.0.1

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/.editorconfig ADDED
@@ -0,0 +1,11 @@
1
+ root = true
2
+
3
+ [*]
4
+ end_of_line = lf
5
+ insert_final_newline = true
6
+ charset = utf-8
7
+ indent_size = 4
8
+ trim_trailing_whitespace = true
9
+
10
+ [*.js]
11
+ indent_style = space
package/.eslintignore ADDED
@@ -0,0 +1,2 @@
1
+ dist/*
2
+ node_modules/*
package/.eslintrc.js ADDED
@@ -0,0 +1,3 @@
1
+ module.exports = {
2
+ extends: ['scratch', 'scratch/node', 'scratch/es6']
3
+ };
@@ -0,0 +1,48 @@
1
+ name: CI/CD
2
+
3
+ on:
4
+ workflow_dispatch: # Allows you to run this workflow manually from the Actions tab
5
+ pull_request: # Runs whenever a pull request is created or updated
6
+ push: # Runs whenever a commit is pushed to the repository
7
+ branches: [master, hotfix/*] # ...on any of these branches
8
+
9
+ concurrency:
10
+ group: '${{ github.workflow }} @ ${{ github.event.pull_request.head.label || github.head_ref || github.ref }}'
11
+ cancel-in-progress: true
12
+
13
+ permissions:
14
+ contents: write # publish a GitHub release
15
+ pages: write # deploy to GitHub Pages
16
+ issues: write # comment on released issues
17
+ pull-requests: write # comment on released pull requests
18
+
19
+ jobs:
20
+ ci-cd:
21
+ runs-on: ubuntu-latest
22
+ steps:
23
+ - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4
24
+ - uses: wagoid/commitlint-github-action@5ce82f5d814d4010519d15f0552aec4f17a1e1fe # v5
25
+ if: github.event_name == 'pull_request'
26
+ - uses: actions/setup-node@1a4442cacd436585916779262731d5b162bc6ec7 # v3
27
+ with:
28
+ cache: 'npm'
29
+ node-version-file: '.nvmrc'
30
+ - name: Info
31
+ run: |
32
+ cat <<EOF
33
+ Node version: $(node --version)
34
+ NPM version: $(npm --version)
35
+ GitHub ref: ${{ github.ref }}
36
+ GitHub head ref: ${{ github.head_ref }}
37
+ EOF
38
+ - name: Setup
39
+ run: npm ci
40
+ - name: Lint
41
+ run: npm run lint
42
+ - name: Build
43
+ run: npm run build
44
+ - name: Release
45
+ env:
46
+ NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
47
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
48
+ run: npx --no -- semantic-release
@@ -0,0 +1 @@
1
+ * text eol=lf
@@ -0,0 +1,4 @@
1
+ #!/usr/bin/env sh
2
+ . "$(dirname -- "$0")/_/husky.sh"
3
+
4
+ npx --no-install commitlint --edit "$1"
package/.nvmrc ADDED
@@ -0,0 +1 @@
1
+ v16
package/CHANGELOG.md ADDED
@@ -0,0 +1,19 @@
1
+ # Changelog
2
+
3
+ All notable changes to this project will be documented in this file. See
4
+ [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
+
6
+ ## [1.0.1](https://github.com/scratchfoundation/scratch-render-fonts/compare/v1.0.0...v1.0.1) (2024-02-21)
7
+
8
+
9
+ ### Bug Fixes
10
+
11
+ * bump version to sync with npm registry ([104c050](https://github.com/scratchfoundation/scratch-render-fonts/commit/104c0506658d707081bd29a042f7bae903e9bba2))
12
+
13
+ # 1.0.0 (2024-02-21)
14
+
15
+
16
+ ### Bug Fixes
17
+
18
+ * **deps:** acknowledge semantic-release dev dependency ([0bd6614](https://github.com/scratchfoundation/scratch-render-fonts/commit/0bd6614018b67a655488b71ffd052e43e391a4ac))
19
+ * **deps:** update to semantic-release@^19 ([6bee7ca](https://github.com/scratchfoundation/scratch-render-fonts/commit/6bee7cae2355540d90b2bac2f48c69b96b023cf0))
package/README.md CHANGED
@@ -1,4 +1,22 @@
1
1
  # scratch-render-fonts
2
+
2
3
  Fonts for Scratch SVG rendering
3
4
 
4
- [![CircleCI](https://circleci.com/gh/LLK/scratch-render-fonts/tree/master.svg?style=shield&circle-token=786988d80057cc1ac25c39fb4f5754d736106fa7)](https://circleci.com/gh/LLK/scratch-render-fonts?branch=master)
5
+ [![CI/CD](https://github.com/scratchfoundation/scratch-render-fonts/actions/workflows/ci-cd.yml/badge.svg)](https://github.com/scratchfoundation/scratch-render-fonts/actions/workflows/ci-cd.yml)
6
+
7
+ ## Committing
8
+
9
+ This project uses [semantic release](https://github.com/semantic-release/semantic-release) to ensure version bumps
10
+ follow semver so that projects depending on it don't break unexpectedly.
11
+
12
+ In order to automatically determine version updates, semantic release expects commit messages to follow the
13
+ [conventional-changelog](https://github.com/bcoe/conventional-changelog-standard/blob/master/convention.md)
14
+ specification.
15
+
16
+ Use the [commitizen CLI](https://github.com/commitizen/cz-cli) to make commits formatted in this way:
17
+
18
+ ```bash
19
+ npm install -g commitizen
20
+ ```
21
+
22
+ Now you're ready to make commits using `git cz`.
@@ -0,0 +1,4 @@
1
+ module.exports = {
2
+ extends: ['@commitlint/config-conventional'],
3
+ ignores: [message => message.startsWith('chore(release):')]
4
+ };
package/package.json CHANGED
@@ -1,34 +1,45 @@
1
1
  {
2
2
  "name": "scratch-render-fonts",
3
- "version": "1.0.0-prerelease.20231017225105",
3
+ "version": "1.0.1",
4
4
  "description": "",
5
5
  "main": "./src/index.js",
6
6
  "author": "Massachusetts Institute of Technology",
7
+ "homepage": "https://github.com/scratchfoundation/scratch-render-fonts#readme",
7
8
  "repository": {
8
9
  "type": "git",
9
- "url": "git+ssh://git@github.com/LLK/scratch-render-fonts.git"
10
+ "url": "https://git@github.com/scratchfoundation/scratch-render-fonts.git"
10
11
  },
11
12
  "scripts": {
12
- "build": "npm run clean && webpack --progress --colors --bail",
13
+ "build": "npm run clean && webpack --progress --bail",
13
14
  "clean": "rimraf ./dist",
15
+ "lint": "eslint .",
14
16
  "test": "npm run build",
15
- "watch": "webpack --progress --colors --watch"
17
+ "watch": "webpack --progress --watch"
18
+ },
19
+ "config": {
20
+ "commitizen": {
21
+ "path": "cz-conventional-changelog"
22
+ }
16
23
  },
17
- "homepage": "https://github.com/LLK/scratch-render-fonts#readme",
18
24
  "dependencies": {
19
- "base64-loader": "1.0.0"
25
+ "base64-loader": "^1.0.0"
20
26
  },
21
27
  "devDependencies": {
28
+ "@commitlint/cli": "17.8.0",
29
+ "@commitlint/config-conventional": "17.8.0",
22
30
  "babel-core": "6.26.3",
23
- "babel-eslint": "^8.1.2",
31
+ "babel-eslint": "10.1.0",
24
32
  "babel-loader": "7.1.5",
25
33
  "babel-preset-env": "1.7.0",
26
- "eslint": "^4.14.0",
27
- "eslint-config-scratch": "^5.0.0",
28
- "json": "^10.0.0",
34
+ "eslint": "8.56.0",
35
+ "eslint-config-scratch": "9.0.3",
36
+ "husky": "8.0.3",
37
+ "json": "10.0.0",
29
38
  "lodash.defaultsdeep": "4.6.1",
30
- "rimraf": "^2.6.1",
31
- "webpack": "^4.43.0",
32
- "webpack-cli": "^3.3.11"
39
+ "rimraf": "2.7.1",
40
+ "scratch-semantic-release-config": "1.0.8",
41
+ "semantic-release": "19.0.5",
42
+ "webpack": "4.47.0",
43
+ "webpack-cli": "3.3.12"
33
44
  }
34
45
  }
@@ -0,0 +1,13 @@
1
+ module.exports = {
2
+ extends: 'scratch-semantic-release-config',
3
+ branches: [
4
+ {
5
+ name: 'master'
6
+ // default channel
7
+ },
8
+ {
9
+ name: 'hotfix/*',
10
+ channel: 'hotfix'
11
+ }
12
+ ]
13
+ };
package/renovate.json5 CHANGED
@@ -2,6 +2,6 @@
2
2
  "$schema": "https://docs.renovatebot.com/renovate-schema.json",
3
3
 
4
4
  "extends": [
5
- "github>scratchfoundation/scratch-renovate-config"
5
+ "github>scratchfoundation/scratch-renovate-config:js-lib-bundled"
6
6
  ]
7
7
  }
@@ -0,0 +1,7 @@
1
+ module.exports = {
2
+ root: true,
3
+ extends: ['scratch', 'scratch/es6'],
4
+ env: {
5
+ browser: true
6
+ }
7
+ };
package/src/index.js CHANGED
@@ -1,41 +1,41 @@
1
- // Synchronously load TTF fonts.
2
- // First, have Webpack load their data as Base 64 strings.
3
- let FONTS;
4
-
5
- const getFonts = function () {
6
- if (FONTS) return FONTS;
7
- /* eslint-disable global-require */
8
- FONTS = {
9
- 'Sans Serif': require('base64-loader!./NotoSans-Medium.ttf'),
10
- 'Serif': require('base64-loader!./SourceSerifPro-Regular.otf'),
11
- 'Handwriting': require('base64-loader!./handlee-regular.ttf'),
12
- 'Marker': require('base64-loader!./Knewave.ttf'),
13
- 'Curly': require('base64-loader!./Griffy-Regular.ttf'),
14
- 'Pixel': require('base64-loader!./Grand9K-Pixel.ttf'),
15
- 'Scratch': require('base64-loader!./Scratch.ttf')
16
- };
17
- /* eslint-enable global-require */
18
-
19
- // For each Base 64 string,
20
- // 1. Replace each with a usable @font-face tag that points to a Data URI.
21
- // 2. Inject the font into a style on `document.body`, so measurements
22
- // can be accurately taken in SvgRenderer._transformMeasurements.
23
- for (const fontName in FONTS) {
24
- const fontData = FONTS[fontName];
25
- FONTS[fontName] = '@font-face {' +
26
- `font-family: "${fontName}";src: url("data:application/x-font-ttf;charset=utf-8;base64,${fontData}");}`;
27
- }
28
-
29
- if (!document.getElementById('scratch-font-styles')) {
30
- const documentStyleTag = document.createElement('style');
31
- documentStyleTag.id = 'scratch-font-styles';
32
- for (const fontName in FONTS) {
33
- documentStyleTag.textContent += FONTS[fontName];
34
- }
35
- document.body.insertBefore(documentStyleTag, document.body.firstChild);
36
- }
37
-
38
- return FONTS;
39
- }
40
-
41
- module.exports = getFonts;
1
+ // Synchronously load TTF fonts.
2
+ // First, have Webpack load their data as Base 64 strings.
3
+ let FONTS;
4
+
5
+ const getFonts = function () {
6
+ if (FONTS) return FONTS;
7
+ /* eslint-disable global-require */
8
+ FONTS = {
9
+ 'Sans Serif': require('base64-loader!./NotoSans-Medium.ttf'),
10
+ 'Serif': require('base64-loader!./SourceSerifPro-Regular.otf'),
11
+ 'Handwriting': require('base64-loader!./handlee-regular.ttf'),
12
+ 'Marker': require('base64-loader!./Knewave.ttf'),
13
+ 'Curly': require('base64-loader!./Griffy-Regular.ttf'),
14
+ 'Pixel': require('base64-loader!./Grand9K-Pixel.ttf'),
15
+ 'Scratch': require('base64-loader!./Scratch.ttf')
16
+ };
17
+ /* eslint-enable global-require */
18
+
19
+ // For each Base 64 string,
20
+ // 1. Replace each with a usable @font-face tag that points to a Data URI.
21
+ // 2. Inject the font into a style on `document.body`, so measurements
22
+ // can be accurately taken in SvgRenderer._transformMeasurements.
23
+ for (const fontName in FONTS) {
24
+ const fontData = FONTS[fontName];
25
+ FONTS[fontName] = '@font-face {' +
26
+ `font-family: "${fontName}";src: url("data:application/x-font-ttf;charset=utf-8;base64,${fontData}");}`;
27
+ }
28
+
29
+ if (!document.getElementById('scratch-font-styles')) {
30
+ const documentStyleTag = document.createElement('style');
31
+ documentStyleTag.id = 'scratch-font-styles';
32
+ for (const fontName in FONTS) {
33
+ documentStyleTag.textContent += FONTS[fontName];
34
+ }
35
+ document.body.insertBefore(documentStyleTag, document.body.firstChild);
36
+ }
37
+
38
+ return FONTS;
39
+ };
40
+
41
+ module.exports = getFonts;
@@ -1,87 +0,0 @@
1
- version: 2.1
2
-
3
- executors:
4
- default-executor:
5
- docker:
6
- - image: "cimg/node:8.17.0"
7
- working_directory: ~/project
8
- resource_class: medium
9
-
10
- commands:
11
- setup:
12
- steps:
13
- - run:
14
- name: Setup
15
- command: |
16
- npm ci
17
- test:
18
- steps:
19
- - run:
20
- name: Test
21
- command: |
22
- npm run test
23
- setup_deploy:
24
- steps:
25
- - run:
26
- name: Setup Deploy
27
- command: |
28
- echo "export NPM_TAG=latest" >> $BASH_ENV
29
- echo "export NODE_ENV=production" >> $BASH_ENV
30
- echo "export RELEASE_TIMESTAMP=$(date +'%Y%m%d%H%M%S')" >> $BASH_ENV
31
- npm run build
32
- VPKG=$($(npm bin)/json -f package.json version)
33
- echo "export VERSION=${VPKG}-prerelease.$(date +%Y%m%d%H%M%S)" >> $BASH_ENV
34
-
35
- deploy:
36
- steps:
37
- - run:
38
- name: Deploy
39
- command: |
40
- npm --no-git-tag-version version $VERSION
41
- npm set //registry.npmjs.org/:_authToken=$NPM_TOKEN
42
- npm publish
43
-
44
- jobs:
45
- build-and-test:
46
- executor: default-executor
47
- steps:
48
- - checkout
49
- - setup
50
- - test
51
- - persist_to_workspace:
52
- root: ~/project
53
- paths: .
54
- deploy:
55
- executor: default-executor
56
- steps:
57
- - attach_workspace:
58
- at: ~/project
59
- - setup_deploy
60
- - deploy
61
-
62
- workflows:
63
- build-and-test-workflow:
64
- when:
65
- not:
66
- or:
67
- - equal: [ master, <<pipeline.git.branch>> ]
68
- - equal: [ develop, <<pipeline.git.branch>> ]
69
- - matches: { pattern: "^hotfix.*", value: <<pipeline.git.branch>> }
70
- - matches: { pattern: "^release.*", value: <<pipeline.git.branch>> }
71
- jobs:
72
- - build-and-test
73
-
74
- deploy-workflow:
75
- when:
76
- or:
77
- - equal: [ master, <<pipeline.git.branch>> ]
78
- - equal: [ develop, <<pipeline.git.branch>> ]
79
- - matches: { pattern: "^hotfix.*", value: <<pipeline.git.branch>> }
80
- - matches: { pattern: "^release.*", value: <<pipeline.git.branch>> }
81
- jobs:
82
- - build-and-test
83
- - deploy:
84
- context:
85
- - scratch-npm-creds
86
- requires:
87
- - build-and-test