New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

unify-token

Package Overview
Dependencies
Maintainers
3
Versions
75
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

unify-token - npm Package Compare versions

Comparing version 1.4.0-beta-8 to 1.4.0-dev-1

16

build/color.js

@@ -1,2 +0,2 @@

const Neutral = {
export const Neutral = {
N0: '#FFFFFF',

@@ -15,3 +15,3 @@ N100: '#DBDEE2',

const Red = {
export const Red = {
R100: '#FFEAEF',

@@ -25,3 +25,3 @@ R200: '#FFCCD9',

const Green = {
export const Green = {
G100: '#EBFFEF',

@@ -35,3 +35,3 @@ G200: '#D6FFDE',

const Blue = {
export const Blue = {
B100: '#E5F5FF',

@@ -45,3 +45,3 @@ B200: '#CCEBFF',

const Purple = {
export const Purple = {
P100: '#FBE7FF',

@@ -55,3 +55,3 @@ P200: '#EEBBFF',

const Teal = {
export const Teal = {
T100: '#EBF6F6',

@@ -65,3 +65,3 @@ T200: '#D2F2F2',

const Yellow = {
export const Yellow = {
Y100: '#FFFAE6',

@@ -73,3 +73,1 @@ Y200: '#FFF0B3',

}
module.exports = {Neutral,Red,Green,Blue,Purple,Teal,Yellow};

@@ -1,2 +0,2 @@

const breakpoint = {
export const breakpoint = {
mobile: '768px',

@@ -7,3 +7,3 @@ tablet: '1024px',

const breakpointRAW = {
export const breakpointRAW = {
mobile: 768,

@@ -14,3 +14,3 @@ tablet: 1024,

const gutter = {
export const gutter = {
mobile: '8px',

@@ -21,3 +21,3 @@ tablet: '12px',

const gutterRAW = {
export const gutterRAW = {
mobile: 8,

@@ -28,3 +28,3 @@ tablet: 12,

const column = {
export const column = {
mobile: '8px',

@@ -35,3 +35,3 @@ tablet: '12px',

const columnRAW = {
export const columnRAW = {
mobile: 8,

@@ -41,3 +41,1 @@ tablet: 12,

}
module.exports = {breakpoint,breakpointRAW,gutter,gutterRAW,column,columnRAW};

@@ -1,2 +0,2 @@

const spacing = {
export const spacing = {
lvl1: '2px',

@@ -12,3 +12,3 @@ lvl2: '4px',

const spacingRAW = {
export const spacingRAW = {
lvl1: 2,

@@ -24,3 +24,3 @@ lvl2: 4,

const layout = {
export const layout = {
lvl1: '8px',

@@ -37,3 +37,3 @@ lvl2: '16px',

const layoutRAW = {
export const layoutRAW = {
lvl1: 8,

@@ -49,3 +49,1 @@ lvl2: 16,

}
module.exports = {spacing,spacingRAW,layout,layoutRAW};

@@ -1,2 +0,2 @@

const fontType = {
export const fontType = {
stackHeading: 'Nunito Sans',

@@ -9,3 +9,3 @@ desktop: 'Open Sans',

const fontSize = {
export const fontSize = {
lvl1: '10px',

@@ -23,3 +23,3 @@ lvl2: '12px',

const fontSizeRAW = {
export const fontSizeRAW = {
lvl1: 10,

@@ -37,3 +37,3 @@ lvl2: 12,

const fontWeight = {
export const fontWeight = {
regular: 400,

@@ -44,3 +44,3 @@ bold: 700,

const lineHeight = {
export const lineHeight = {
lvl1: '16px',

@@ -58,3 +58,3 @@ lvl2: '18px',

const lineHeightRAW = {
export const lineHeightRAW = {
lvl1: 16,

@@ -71,3 +71,1 @@ lvl2: 18,

}
module.exports = {fontType,fontSize,fontSizeRAW,fontWeight,lineHeight,lineHeightRAW};

@@ -64,5 +64,3 @@ const camelCase = require('lodash/camelCase');

theo.registerFormat('unify.js', result => {
let exportVal = [];
const res = result.get('props').map(prop => {
return result.get('props').map(prop => {
const name = camelCase(prop.get('name'))

@@ -73,5 +71,5 @@ const unit = prop.get('unit')

const category = prop.get('category')
const opening = `const ${name} = {\n`
const opening = `export const ${name} = {\n`
const closing = `}\n`
const openingRAW = `\nconst ${name}RAW = {\n`
const openingRAW = `\nexport const ${name}RAW = {\n`
const closingRAW = `}\n`

@@ -120,17 +118,10 @@ let content = ''

exportVal = [...exportVal, name, !unitWhitelist.includes(category) ? name + 'RAW' : ''];
return mainModule + rawModule
}).toJS().join('\n')
return `${res}\nmodule.exports = {${exportVal.filter(Boolean).join(',')}};`
})
theo.registerFormat('unify-color.js', result => {
let exportVal = [];
const res = result.get('props').map(prop => {
const name = prop.get('name');
return result.get('props').map(prop => {
const value = prop.get('value')
const opening = `const ${name} = {\n`
const opening = `export const ${prop.get('name')} = {\n`
const closing = `}\n`

@@ -140,4 +131,2 @@ let content = ''

exportVal = [...exportVal, name];
value.map((key, index) => valueObject[index] = `${tinycolor(key).toHexString().toUpperCase()}`)

@@ -157,4 +146,2 @@

}).toJS().join('\n')
return `${res}\nmodule.exports = {${exportVal.join(',')}};`
})

@@ -269,65 +256,2 @@

theo.registerFormat('unify-color.swift', result => {
let colorObject = []
result.get('props').map(prop => {
prop.get('value').map((key, index) => {
colorObject.push({
name: `${index.toLowerCase()}`,
value: {
red: Math.round((tinycolor(key).toRgb().r/255) * 10000000000)/10000000000,
green: Math.round((tinycolor(key).toRgb().g/255) * 10000000000)/10000000000,
blue: Math.round((tinycolor(key).toRgb().b/255) * 10000000000)/10000000000,
alpha: Math.round(tinycolor(key).toRgb().a)
}
})
})
})
/**
* please ignore indentation, enter and spacing for the return
* because its will effect the generated file
*/
return `extension UIColor {
${colorObject.map((data,index)=>{return `
public static var ${data.name}: UIColor {
return #colorLiteral(red: ${data.value.red}, green: ${data.value.green}, blue: ${data.value.blue}, alpha: ${data.value.alpha})
}`
})}
}`.replace(/},/g,'}\n');
})
theo.registerFormat('unify-typography.swift', result => {
let typographyObject = []
result.get('props').map(prop => {
const mutableCategory = prop.get('category')
if(mutableCategory == 'font-size') {
prop.get('value').map((key, index) => {
typographyObject.push({
name: `${index}`,
value: parseFloat(key)
})
})
}
})
/**
* please ignore indentation, enter and spacing for the return
* because its will effect the generated file
*/
return `extension CGFloat {
${typographyObject.map((data,index)=>{return `${index == 0 ? `//MARK: Size for font`: ``}
static var ${data.name}: CGFloat {
return CGFloat(${data.value})
}`
})}
}`.replace(/},/g,'}\n');
})
// options is optional

@@ -410,42 +334,2 @@ glob("token/*.yml", (er, files) => {

});
// iOS Swift
/**
* for now not all token will be generated to swift
*/
let iOSFiles = files.filter((fileName) => fileName == 'token/color.yml' || fileName == 'token/typography.yml')
iOSFiles.map(file => {
let opt
switch (file) {
case 'token/color.yml':
opt = convertOptions({
file: file,
transformType: 'raw',
formatType: 'unify-color.swift'
})
break;
case 'token/typography.yml':
opt = convertOptions({
file: file,
transformType: 'raw',
formatType: 'unify-typography.swift'
})
break;
}
theo
.convert(opt)
.then(data => {
var newPath = file.split("/").pop().split('.');
fs.writeFile('./build/' + newPath[0] + '.swift', data, function(err) {
if(err) {
return console.log(err);
}
console.log(`The file ${newPath[0] + `.swift`} was saved!`);
});
})
.catch(error => console.log(`Something went wrong in generating file iOS: ${error}`));
});
})
})
{
"name": "unify-token",
"version": "1.4.0-beta-8",
"sideEffects": false,
"version": "1.4.0-dev-1",
"description": "Design Tokens for the Unify Design System",
"main": "README.md",
"sideEffects": false,
"main": "build/index.js",
"scripts": {

@@ -12,3 +12,5 @@ "build": "rimraf ./build && node globfile.js",

"sketch-json": "rimraf ./sketch-json ./sketch/test.zip && sketch-json *.sketch",
"prepublishOnly": "npm run build"
"prepublishOnly": "npm run build",
"build:wp": "npm run build && NODE_ENV=production webpack -p",
"build2": "NODE_ENV=development webpack -p"
},

@@ -20,11 +22,11 @@ "keywords": [

"devDependencies": {
"@babel/core": "^7.4.5",
"@babel/plugin-transform-modules-umd": "^7.2.0",
"@babel/preset-env": "^7.4.5",
"babel-loader": "^8.0.6",
"glob": "7.1.3",
"rimraf": "^2.6.2",
"babel-preset-env": "^1.7.0",
"glob": "^7.1.4",
"rimraf": "^2.6.3",
"theo": "8.0.1",
"webpack": "^4.32.2"
"webpack": "^4.35.0",
"webpack-cli": "^3.3.5"
}
}
const path = require('path');
const glob = require('glob');
const isDev = process.env.NODE_ENV !== "production";
const ignoredEntries = {
ignore: path.resolve(__dirname, './build/**/*.{swift,xml}'),
};
const entries = glob
.sync(path.resolve(__dirname, './build/**/*.js'), ignoredEntries)
.reduce(function(obj, filePath) {
const entry = path.basename(filePath, '.js');
obj[entry] = filePath;
return obj;
}, {});
module.exports = {
mode: 'production',
entry: {
color: './build/color.js',
grid: './build/grid.js',
spacing: './build/spacing.js',
typography: './build/typography.js'
},
mode: 'development',
entry: entries,
output: {
path: path.join(__dirname, 'build'),
filename: '[name].js',
path: path.resolve(__dirname, 'build'),
libraryTarget: 'umd',
},

@@ -19,12 +29,6 @@ module: {

{
test: /\.m?js$/,
exclude: /(node_modules|bower_components)/,
test: /\.js$/i,
exclude: /node_modules/i,
use: {
loader: 'babel-loader',
options: {
presets: ['@babel/preset-env'],
plugins: [
"@babel/plugin-transform-modules-umd"
]
}
loader: "babel-loader"
}

@@ -34,6 +38,2 @@ }

},
optimization: {
sideEffects: true,
usedExports: true
}
}
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc