# @iceland/intelligent-code

> Convert DSL into code intelligently.

Latest version **1.1.5** (published 2019-06-21) · MIT license · 0 weekly downloads

## Install

```sh
npm install @iceland/intelligent-code
pnpm add @iceland/intelligent-code
yarn add @iceland/intelligent-code
bun add @iceland/intelligent-code
```

## Health

**Score 40/100 (D)** — status: abandoned.

Positive: has types; no vulnerabilities; high quality score; popular repo.

Warnings: low downloads; no esm support.

Negative: abandoned.

## Facts

| | |
|---|---|
| Version | 1.1.5 |
| Published | 2019-06-21 |
| First published | 2018-11-20 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 7 |
| Unpacked size | 92.6 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 18615 |
| Maintainers | boia, empireo, oraaange, sobear, temper357, yuanyan |

## Links

- npm: https://www.npmjs.com/package/@iceland/intelligent-code
- Repository: https://github.com/alibaba/ice
- Homepage: https://github.com/alibaba/ice#readme
- Issues: https://github.com/alibaba/ice/issues
- npm.io page: https://npm.io/package/@iceland/intelligent-code

## Dependencies (7)

- [debug](https://npm.io/package/debug.md) ^3.0.1
- [lodash](https://npm.io/package/lodash.md) ^4.17.11
- [babylon](https://npm.io/package/babylon.md) ^6.18.0
- [prettier](https://npm.io/package/prettier.md) ^1.7.4
- [decamelize](https://npm.io/package/decamelize.md) ^1.0.0
- [match-require](https://npm.io/package/match-require.md) ^2.1.0
- [babel-generator](https://npm.io/package/babel-generator.md) ^6.26.1

## Recent versions

- 1.1.5 (latest) — 2019-06-21
- 1.0.20-alpha.1 (beta) — 2019-03-21
- 1.1.4 — 2019-06-10
- 1.1.3 — 2019-05-14
- 1.1.1 — 2019-03-27
- 1.1.0 — 2019-03-27
- 1.0.20-alpha.0 — 2019-03-19
- 1.0.19 — 2019-03-05
- 1.0.18 — 2019-01-09
- 1.0.17 — 2018-12-24
- 1.0.16 — 2018-12-24
- 1.0.12 — 2018-12-13
- 1.0.11 — 2018-12-10
- 1.0.9 — 2018-12-06
- 1.0.7 — 2018-12-03
- … 4 more at https://npm.io/package/@iceland/intelligent-code/versions

## README

# Intelligent Code

将 json 转化为代码，使用方式参考 `test`.

## Usage

Source Data(see /lib/interfaces.d.ts):

```javascript
const sourceData = {
    id: 'div-1',
    type: 'div',
    children: [
        {
            id: 'spn-1',
            type: 'span',
            children: '你的名字：'
        },
        {
            id: 'Input-2',
            type: 'Input',
            npmName: '@icedesign/base',
            props: {
                style: {
                    fontSize: 28,
                    fontWeight: 'bold'
                },
                value: '阿里巴巴'
            }
        }
    ]
};
```

Use intelligent-code:

```javascript
const intelligentCode = require('@ali/iceland-intelligent-code');
const result = intelligentCode(sourceData);

/*
{
  codeFileTree: {
    'index.jsx': ``,
    'stores': {},
    'actions': {}
  },
  entryFileName: 'index.jsx'
  deps: []
}
*/
```

The expected output:

```javascript
import React, { Component } from 'react';
import ReactDOM from 'react-dom';
import { Input } from '@icedesign/base';

class div1 extends Component {

    render() {
        return (
            <div>
                <span>
                    你的名字：
                </span>
                <Input style={styles.yourNameInput} value="阿里巴巴" />
            </div>
        );
    }
}

const styles = {
    "yourNameInput": {
        "fontSize": 28,
        "fontWeight": "bold"
    }
};


ReactDOM.render(<div1 />, mountNode);
```

---
_Source: https://npm.io/package/@iceland/intelligent-code · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
