Skip to content

Commit

Permalink
update package-lock.json
Browse files Browse the repository at this point in the history
  • Loading branch information
lukasoppermann committed Apr 17, 2024
1 parent 6e95ef1 commit c6ae056
Show file tree
Hide file tree
Showing 3 changed files with 82 additions and 79 deletions.
74 changes: 38 additions & 36 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 4 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
"homepage": "https://github.com/primer/primitives#readme",
"scripts": {
"build": "ts-node ./scripts/build.ts && tsc --project tsconfig.build.json",
"build:next": "npm run build:v8 && npm run build:fallbacks && npm run build:figma",
"build:next": "npm run build:v8 && npm run build:fallbacks && npm run build:figma && npm run build:intellisense",
"build:v8": "ts-node ./scripts/buildTokens.ts",
"build:fallbacks": "ts-node ./scripts/buildFallbacks.ts",
"build:figma": "ts-node scripts/buildFigma.ts",
Expand Down Expand Up @@ -63,12 +63,13 @@
"@github/prettier-config": "^0.0.6",
"@playwright/test": "^1.43.0",
"@types/flat": "^5.0.1",
"@types/glob": "^8.1.0", "@types/jest": "^29.5.2",
"@types/glob": "^8.1.0",
"@types/jest": "^29.5.2",
"@types/lodash": "^4.14.195",
"@types/node": "^20.4.0",
"@typescript-eslint/eslint-plugin": "^5.61.0",
"@typescript-eslint/parser": "^5.61.0",
"camelcase-keys": "^6.2.2",
"camelcase-keys": "^6.2.2",
"color-blend": "^4.0.0",
"color2k": "^2.0.0",
"console-table-printer": "^2.11.1",
Expand Down
80 changes: 40 additions & 40 deletions scripts/createPropertyVariableMap.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,21 +8,20 @@ import postcss from 'postcss'
import type {Properties} from 'csstype'
import {flatten as flattenArray, uniqBy, kebabCase} from 'lodash'
import {flatten as flattenObject} from 'flat'
import {getTokensByName} from '~/docs/storybook/stories/utilities/getTokensByName'
import {getTokensByName} from '../docs/storybook/stories/utilities/getTokensByName'
import type StyleDictionary from 'style-dictionary'

// stories
import functionalTypographyTokens from '~/dist/docs/functional/typography/typography.json'
import baseTypographyTokens from '~/dist/docs/base/typography/typography.json'
import functionalBorderTokens from '~/dist/docs/functional/size/border.json'
import functionalSizeTokens from '~/dist/docs/functional/size/size.json'
import functionalSizeFineTokens from '~/dist/docs/functional/size/size-fine.json'
import baseSizeTokens from '~/dist/docs/base/size/size.json'
import functionalColorTokens from '~/dist/docs/functional/themes/light.json'
import functionalTypographyTokens from '../dist/docs/functional/typography/typography.json'
import baseTypographyTokens from '../dist/docs/base/typography/typography.json'
import functionalBorderTokens from '../dist/docs/functional/size/border.json'
import functionalSizeTokens from '../dist/docs/functional/size/size.json'
import functionalSizeFineTokens from '../dist/docs/functional/size/size-fine.json'
import baseSizeTokens from '../dist/docs/base/size/size.json'
import functionalColorTokens from '../dist/docs/functional/themes/light.json'

// path relative to script
const tokensDirectory = path.join(__dirname, '../dist')

if (!fs.existsSync(tokensDirectory)) {
// eslint-disable-next-line no-console
console.log(`tokens not found at ${tokensDirectory}, please run this script after running build:next`)
Expand Down Expand Up @@ -186,37 +185,38 @@ propertyMap['breakpoint'] = variables.filter(({file}) => file.name === 'breakpoi
}
})

const logUnassignedVariables = () => {
const stringified = JSON.stringify(propertyMap)
const unassigned: Variable[] = []

variables
.filter(variable => {
// TODO: check if we should be ignoring
if (
variable.name.includes('prettylights-syntax') ||
variable.name.includes('codeMirror-syntax') ||
variable.name.includes('color-ansi')
)
return false
return true
})
.map(variable => {
if (!stringified.includes(variable.name)) unassigned.push(variable)
})

return unassigned
}

const unusedVariables = logUnassignedVariables()

if (unusedVariables.length > 0) {
// eslint-disable-next-line no-console
console.log(`Found unused variables, failing build`)
// eslint-disable-next-line no-console
console.log(unusedVariables)
process.exit(1)
}
// const logUnassignedVariables = () => {
// const stringified = JSON.stringify(propertyMap)
// const unassigned: Variable[] = []

// variables
// .filter(variable => {
// // TODO: check if we should be ignoring
// if (
// variable.name.includes('prettylights-syntax') ||
// variable.name.includes('codeMirror-syntax') ||
// variable.name.includes('color-ansi')
// )
// return false
// return true
// })
// .map(variable => {
// if (!stringified.includes(variable.name)) unassigned.push(variable)
// })

// return unassigned
// }

// TODO: re-enable this check and figure out why it was there
// const unusedVariables = logUnassignedVariables()

// if (unusedVariables.length > 0) {
// // eslint-disable-next-line no-console
// console.log(`Found unused variables, failing build`)
// // eslint-disable-next-line no-console
// console.log(unusedVariables)
// process.exit(1)
// }

// it's better to be explicit than fuzzy match to avoid bad hints
// for example, borderImage properties should not show border hints
Expand Down

0 comments on commit c6ae056

Please sign in to comment.